• Stars
    star
    799
  • Rank 56,592 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

local development server that aims to make using browserify fast and fun

beefy

a local development server designed to work with browserify.

it:

  • can live reload your browser when your code changes (if you want)
  • works with whatever version of browserify or watchify; globally installed or locally installed to node_modules/.
  • will spit compile errors out into the browser so you don't have that 1-2 seconds of cognitive dissonance and profound ennui that follows refreshing the page only to get a blank screen.
  • will spit out a default index.html for missing routes so you don't need to even muck about with HTML to get started
  • serves up static files with grace and aplomb (and also appropriate mimetypes)
  • is designed to fall away gracefully, as your project gets bigger.
  • loves you, unconditionally

how do I get it?

npm install -g beefy; and if you want to always have a browserify available for beefy to use, npm install -g browserify.

usage

$ cd directory/you/want/served
$ beefy path/to/thing/you/want/browserified.js [PORT] [-- browserify args]

what bundler does it use?

Beefy searches for bundlers in the following order:

  • First, it checks your local project's node_modules for watchify.
  • Then it checks locally for browserify.
  • Failing that, it checks for a global watchify.
  • Then falls back to a global browserify.

path/to/file.js

the path to the file you want browserified. can be just a normal node module. you can also alias it: path/to/file.js:bundle.js if you want -- so all requests to bundle.js will browserify path/to/file.js. this is helpful for when you're writing gh-pages-style sites that already have an index.html, and expect the bundle to be pregenerated and available at a certain path.

You may provide multiple entry points, if you desire!

--browserify command

--bundler command

use command instead of browserify or ./node_modules/.bin/browserify.

in theory, you could even get this working with r.js, but that would probably be scary and bats would fly out of it. but it's there if you need it! if you want to use r.js with beefy, you'll need a config that can write the resulting bundle to stdout, and you can run beefy with beefy :output-url.js --bundler r.js -- -o config.js.

NB: This will not work in Windows.

--live

Enable live reloading. this'll start up a sideband server and an fs watch on the current working directory -- if you save a file, your browser will refresh.

if you're not using the generated index file, beefy has your back -- it'll still automatically inject the appropriate script tag.

    <script src="/-/live-reload.js"></script>

--cwd dir

serve files as if running from dir.

--debug=false

turn off browserify source map output. by default, beefy automatically inserts -d into the browserify args -- this turns that behavior off.

--open

automatically discover a port and open it using your default browser.

--index=path/to/file

Provide your own default index! This works great for single page apps, as every URL on your site will be redirected to the same HTML file. Every instance of {{entry}} will be replaced with the entry point of your app.

api

var beefy = require('beefy')
  , http = require('http')

var handler = beefy('entry.js')

http.createServer(handler).listen(8124)

Beefy defaults the cwd to the directory of the file requiring it, so it's easy to switch from CLI mode to building a server.

As your server grows, you may want to expand on the information you're giving beefy:

var beefy = require('beefy')
  , http = require('http')

http.createServer(beefy({
    entries: ['entry.js']
  , cwd: __dirname
  , live: true
  , quiet: false
  , bundlerFlags: ['-t', 'brfs']
  , unhandled: on404
})).listen(8124)

function on404(req, resp) {
  resp.writeHead(404, {})
  resp.end('sorry folks!')
}

beefy(opts: BeefyOptions, ready: (err: Error) => void)

Create a request handler suitable for providing to http.createServer. Calls ready once the appropriate bundler has been located. If ready is not provided and a bundler isn't located, an error is thrown.

BeefyOptions

Beefy's options are a simple object, which may contain the following attributes:

  • cwd: String. The base directory that beefy is serving. Defaults to the directory of the module that first required beefy.
  • quiet: Boolean. Whether or not to output request information to the console. Defaults to true.
  • live: Boolean. Whether to enable live reloading. Defaults to false.
  • bundler: null, String, or Function. If a string is given, beefy will attempt to run that string as a child process whenever the path is given. If a function is given, it is expected to accept a path and return an object comprised of {stdout: ReadableStream, stderr: ReadableStream}. If not given, beefy will search for an appropriate bundler.
  • bundlerFlags: Flags to be passed to the bundler. Ignored if bundler is a function.
  • entries: String, Array, or Object. The canonical form is that of an object mapping URL pathnames to paths on disk relative to cwd. If given as an array or string, entries will be mapped like so: index.js will map /index.js to <cwd>/index.js.
  • unhandled: Function accepting req and resp. Called for 404s. If not given, a default 404 handler will be used.
  • watchify: defaults to true -- when true, beefy will prefer using watchify to browserify. If false, beefy will prefer browserify.

Beefy may accept, as a shorthand, beefy("file.js") or beefy(["file.js"]).

license

MIT

More Repositories

1

git-rs

git, implemented in rust, for fun and education πŸ¦€
Rust
1,335
star
2

raf

requestAnimationFrame polyfill library
JavaScript
740
star
3

plate

a javascript template library, aimed at being compatible with django's template language.
JavaScript
183
star
4

ormnomnom

an orm that does 80% of the work and gets out of the way for the remaining 20%
JavaScript
169
star
5

cssauron

create matching selectors from css for your very own nested object hierarchy
JavaScript
113
star
6

bops

buffer operations
JavaScript
100
star
7

wilson

a node.js framework that glues together routes, views, orms, and things. designed to help tim allen navigate his day.
JavaScript
95
star
8

varint

use msb to create integer values of varying sizes
JavaScript
90
star
9

vkey

map ev.keyCode to human names
JavaScript
81
star
10

nojs

☁️☁️ nothing to see, a PLAN, and the ability to load lodash ☁️☁️
Python
73
star
11

node-python

a binding between node.js (really, the V8 engine) and python. super beta super buggy super great
C++
67
star
12

sse-stream

expose html5 server sent events (sse) as a writable stream
JavaScript
57
star
13

clawbang

#!/usr/bin/env πŸ¦€
Rust
52
star
14

glslmin

CLI tool to minify and bundle glsl programs
C
37
star
15

fullscreen

fullscreen polyfill api that presents an event emitter
JavaScript
36
star
16

reverse

πŸ’ž An HTTP router that provides reversing capabilities.
JavaScript
33
star
17

inflate

pure javascript inflate implemented as a through stream
JavaScript
33
star
18

provenance

visualize dependencies between functions in your JS
JavaScript
32
star
19

spatial-events

3d spatially aware event emitter
JavaScript
30
star
20

digraph-tag

ES6 string template tag for quickly generating directed graph data
JavaScript
30
star
21

browservefy

simplehttpserver / webrick replacement that automatically responds to a given entry point path with the results of browserify <that path>
JavaScript
28
star
22

python-javascript

A pure python implementation of JavaScript, just because.
Python
25
star
23

tide-http-auth

HTTP auth for tide! Pretty Basic, if you'll Bearer with me
Rust
25
star
24

jik

use css selectors to grep your JS codebase
JavaScript
24
star
25

node-runforcover

A require hook for node-bunker to emit coverage data.
JavaScript
24
star
26

rewrite-js

CLI tool to transform javascript programs using falafel
JavaScript
24
star
27

aabb-2d

2d axis aligned bounding boxes
JavaScript
20
star
28

setup-yq

JavaScript
20
star
29

aabb-3d

3d axis aligned bounding boxes
JavaScript
20
star
30

tracejs

Expand Node.js Error.stack traces into usable objects providing context and highlighting
JavaScript
20
star
31

kb-controls

present a polling interface for keyboard state given a binding object
JavaScript
19
star
32

asm-tag

compile x64 assembly into a callable function
JavaScript
19
star
33

escontrol

JavaScript
18
star
34

add-event-listener

add event listeners in IE and ... everywhere else
JavaScript
17
star
35

voxel-physical

create objects that have aabbs and respond to accel and vel updates
JavaScript
16
star
36

drag-stream

streamable mouse drag data
JavaScript
16
star
37

jabbascript

lightweight syntax additions to javascript, from a curmudgeon who loves javascript just the way it is
JavaScript
16
star
38

node-piano

A node.js require-hook for instrumenting your javascript code
JavaScript
15
star
39

mdn-cli

a CLI for accessing mozilla dev network docs in your terminal
Rust
14
star
40

cssauron-falafel

falafel bindings for cssauron
JavaScript
14
star
41

platoon

a javascript testing framework whose goals are to work gracefully with callbacks, both in node.js and the browser
JavaScript
14
star
42

essim

JavaScript
14
star
43

json-parse-stream

streaming json parser
JavaScript
14
star
44

stream-exhaust

Ensure that a stream is flowing data without mutating it
JavaScript
13
star
45

domnode-dom

DOMNode streams for HTMLElements
JavaScript
13
star
46

redispump

pipe stdout to a redis pubsub channel
JavaScript
13
star
47

jsl

a modular js linter
JavaScript
12
star
48

interact

a readable stream of mouse view events, wrapping up pointer-lock and drag-stream
JavaScript
12
star
49

simplee

A simple EventEmitter utility library for client-side use. Mimics Node.js's EventEmitter object.
JavaScript
12
star
50

yrc

you're real cool - a javascript parser written in c
C
12
star
51

tempisfugit

a node.js async binding to git. holy crap.
JavaScript
12
star
52

django-butter

Butter forms for Django (wokka-wokka-wokka)
Python
12
star
53

djamocha

Django and Mocha unit tests (with a CLI test runner)
JavaScript
11
star
54

npm-get-dependents

get all dependents of an npm package
JavaScript
11
star
55

tinybabygame

a little baby game i wrote in javascript using canvas.
JavaScript
10
star
56

voxel-control

manipulate voxel-physical objects using FPS-style controls
JavaScript
10
star
57

utensil

CLI tool to fork, run, and monitor node.js servers
JavaScript
10
star
58

worker.js

A semi-polyfill api for web workers. Aimed at making the experience fun (and not at all painful!)
JavaScript
9
star
59

git-to-js

translate git raw objects into javascript objects
JavaScript
9
star
60

narrativ

kind of a rip-off of docco, looking to make generating complex trees of literate-programming documentation easier.
JavaScript
9
star
61

directed-graph-to-dag

given a directed graph, return a set of edges to reverse to remove any cycles
JavaScript
9
star
62

waiter

a domain specific language/api for RESTful interfaces, inspired by Dolt
Python
9
star
63

normalize-css

normalize.css (from http://necolas.github.com/normalize.css/)
CSS
9
star
64

simplify-dag

given a directed acyclic graph, contract straight-line runs to single vertices
JavaScript
8
star
65

phone-sensor

turn your phone into a sensor for great justice.
JavaScript
8
star
66

pointer-lock

pointer lock polyfill that presents an eventemitter / stream api
JavaScript
8
star
67

gsv

github search vehicle
JavaScript
8
star
68

w3c-blob

w3c dom blob api in node and browser
JavaScript
8
star
69

postpie

a backend and transport for pieshop that uses ry's node_postgres binding!
JavaScript
8
star
70

tag_utils

a utility library that aims to alleviate some of the pain of writing django template tags using surlex.
Python
8
star
71

a-wild-version-appears

sometimes versions happen and you want to alert your users
JavaScript
8
star
72

django-bluebird

A Twitter OAuth multi-site authentication backend for Django, and so much more
Python
8
star
73

git-transport-protocol

a r/w stream that wraps a r/w stream and formats the data according to the git transfer protocol
JavaScript
7
star
74

nappingcat

a single-user ssh framework inspired by django
Python
7
star
75

git-the-latest

JavaScript
7
star
76

zigzag

zigzag signed integer encoding and decoding
JavaScript
7
star
77

reverse.js

reverse match your urls in clientside javascript (and node).
JavaScript
7
star
78

dom-event-stream

create a readable stream of dom events given an element
JavaScript
7
star
79

hq

aw heq – a jq-like CLI tool for modifying HTML trees based on CSS selectors
Rust
7
star
80

ls-stream

readable stream of file paths + stat objects
JavaScript
7
star
81

bfy-worker

web workers for browserify made fast, fun, and easy
JavaScript
7
star
82

keyframely

A JQuery-less rewrite of https://github.com/KuraFire/runloop -- usable in Node or in-browser.
JavaScript
7
star
83

git-fetch-pack

git's smart fetch-pack protocol
JavaScript
7
star
84

gl-triangle-strip-indexer

create element indices for triangle strip meshes
JavaScript
6
star
85

texture.js

browserify-compatible webgl 2D texture lib.
JavaScript
6
star
86

dst.js

Date.prototype.isDST() // true or false
JavaScript
6
star
87

tz.js

timezone sniffer in javascript.
JavaScript
6
star
88

git-packidx-parser

git pack index file parser
JavaScript
6
star
89

tar-parse

streaming tar parser
JavaScript
6
star
90

fpsjs

An in-browser multiplayer FPS using WebGL, pointer lock, WebSockets, and WebWorkers (oh my!)
JavaScript
6
star
91

scoped

command line tool exposing lexical-scope
JavaScript
6
star
92

dag-to-layers

assign each vertex of a dag to a layer, inserting dummy vertices
JavaScript
6
star
93

wilson-example

an example project using the wilson node.js framework
JavaScript
6
star
94

clone-packages

clone packages from one registry to another
JavaScript
6
star
95

pacman.js

A bitstream packer targeting canvas elements.
JavaScript
6
star
96

count-docula

An mdast-based tool for generating and testing documentation
JavaScript
6
star
97

cascadiajs-2013

my little parser talk abstract, transcript, demos for cascadiaJS 2013
JavaScript
6
star
98

spatial-trigger

enter/exit events for bounding boxes based on events from spatial-events
JavaScript
5
star
99

discard-stream

a transform stream that buffers up to N items, discarding on further writes
JavaScript
5
star
100

flows

a prototype streams implementation
JavaScript
5
star