{"id":13992015,"url":"https://github.com/chrisdickinson/beefy","last_synced_at":"2025-04-08T04:14:11.180Z","repository":{"id":7638492,"uuid":"8998597","full_name":"chrisdickinson/beefy","owner":"chrisdickinson","description":"local development server that aims to make using browserify fast and fun","archived":false,"fork":false,"pushed_at":"2017-09-25T15:38:32.000Z","size":461,"stargazers_count":799,"open_issues_count":47,"forks_count":58,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-04-26T05:23:42.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://didact.us/beefy/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisdickinson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.mit","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-25T04:13:25.000Z","updated_at":"2024-04-21T13:18:22.000Z","dependencies_parsed_at":"2022-08-30T06:01:14.776Z","dependency_job_id":null,"html_url":"https://github.com/chrisdickinson/beefy","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisdickinson%2Fbeefy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisdickinson%2Fbeefy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisdickinson%2Fbeefy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisdickinson%2Fbeefy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisdickinson","download_url":"https://codeload.github.com/chrisdickinson/beefy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773719,"owners_count":20993639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-09T14:01:44.438Z","updated_at":"2025-04-08T04:14:11.163Z","avatar_url":"https://github.com/chrisdickinson.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Tools"],"sub_categories":["Development Servers"],"readme":"# beefy\n\na local development server designed to work with browserify.\n\nit:\n\n* can live reload your browser when your code changes (if you want)\n* works with whatever version of browserify or watchify; globally installed or \n  locally installed to `node_modules/`.\n* will spit compile errors out into the browser so you don't have that\n  1-2 seconds of cognitive dissonance and profound ennui that follows\n  refreshing the page only to get a blank screen.\n* will spit out a default `index.html` for missing routes so you don't\n  need to even muck about with HTML to get started\n* serves up static files with grace and aplomb (and also appropriate\n  mimetypes)\n* is designed to fall away gracefully, as your project gets bigger.\n* loves you, unconditionally\n\n## how do I get it?\n\n`npm install -g beefy`; and if you want to always have a browserify available\nfor beefy to use, `npm install -g browserify`.\n\n## usage\n\n```javascript\n$ cd directory/you/want/served\n$ beefy path/to/thing/you/want/browserified.js [PORT] [-- browserify args]\n```\n\n## what bundler does it use?\n\nBeefy searches for bundlers in the following order:\n\n* First, it checks your local project's node_modules for watchify.\n* Then it checks locally for browserify.\n* Failing that, it checks for a global watchify.\n* Then falls back to a global browserify.\n\n#### `path/to/file.js`\n\nthe path to the file you want browserified. can be just a normal node module.\nyou can also alias it: `path/to/file.js:bundle.js` if you want -- so all requests\nto `bundle.js` will browserify `path/to/file.js`. this is helpful for when you're\nwriting `gh-pages`-style sites that already have an index.html, and expect the\nbundle to be pregenerated and available at a certain path.\n\nYou may provide multiple entry points, if you desire!\n\n#### `--browserify command`\n#### `--bundler command`\n\nuse `command` instead of `browserify` or `./node_modules/.bin/browserify`.\n\n~~in theory, you could even get this working with `r.js`, but that would probably\nbe scary and bats would fly out of it. but it's there if you need it!~~ if you want\nto use `r.js` with beefy, you'll need a config that can write the resulting bundle\nto stdout, and you can run beefy with `beefy :output-url.js --bundler r.js -- -o config.js`.\n\n**NB:** This will not work in Windows.\n\n#### `--live`\n\nEnable live reloading. this'll start up a sideband server and an `fs` watch on\nthe current working directory -- if you save a file, your browser will refresh.\n\nif you're not using the generated index file, beefy has your back -- it'll still\nautomatically inject the appropriate script tag.\n\n```html\n    \u003cscript src=\"/-/live-reload.js\"\u003e\u003c/script\u003e\n```\n\n#### `--cwd dir`\n\nserve files as if running from `dir`.\n\n#### `--debug=false`\n\nturn off browserify source map output. by default, beefy automatically inserts\n`-d` into the browserify args -- this turns that behavior off.\n\n#### `--open`\n\nautomatically discover a port and open it using your default browser.\n\n#### `--index=path/to/file`\n\nProvide your own default index! This works great for single page apps,\nas every URL on your site will be redirected to the same HTML file. Every\ninstance of `{{entry}}` will be replaced with the entry point of your app.\n\n## api\n\n```javascript\nvar beefy = require('beefy')\n  , http = require('http')\n\nvar handler = beefy('entry.js')\n\nhttp.createServer(handler).listen(8124)\n```\n\nBeefy defaults the `cwd` to the directory of the file requiring it,\nso it's easy to switch from CLI mode to building a server.\n\nAs your server grows, you may want to expand on the information you're\ngiving beefy:\n\n```javascript\nvar beefy = require('beefy')\n  , http = require('http')\n\nhttp.createServer(beefy({\n    entries: ['entry.js']\n  , cwd: __dirname\n  , live: true\n  , quiet: false\n  , bundlerFlags: ['-t', 'brfs']\n  , unhandled: on404\n})).listen(8124)\n\nfunction on404(req, resp) {\n  resp.writeHead(404, {})\n  resp.end('sorry folks!')\n}\n```\n\n### beefy(opts: BeefyOptions, ready: (err: Error) =\u003e void)\n\nCreate a request handler suitable for providing to `http.createServer`.\nCalls `ready` once the appropriate bundler has been located. If `ready`\nis not provided and a bundler isn't located, an error is thrown.\n\n### BeefyOptions\n\nBeefy's options are a simple object, which may contain the following\nattributes:\n\n* `cwd`: String. The base directory that beefy is serving. Defaults to the\ndirectory of the module that **first** required beefy.\n* `quiet`: Boolean. Whether or not to output request information to the console. Defaults to true.\n* `live`: Boolean. Whether to enable live reloading. Defaults to false.\n* `bundler`: null, String, or Function. If a string is given, beefy will\nattempt to run that string as a child process whenever the path is given.\nIf a function is given, it is expected to accept a path and return an \nobject comprised of `{stdout: ReadableStream, stderr: ReadableStream}`. If\nnot given, beefy will search for an appropriate bundler.\n* `bundlerFlags`: Flags to be passed to the bundler. Ignored if `bundler`\nis a function.\n* `entries`: String, Array, or Object. The canonical form is that of an\nobject mapping URL pathnames to paths on disk relative to `cwd`. If given\nas an array or string, entries will be mapped like so: `index.js` will\nmap `/index.js` to `\u003ccwd\u003e/index.js`.\n* `unhandled`: Function accepting req and resp. Called for 404s. If not\ngiven, a default 404 handler will be used.\n* `watchify`: defaults to true -- when true, beefy will prefer using watchify\nto browserify. If false, beefy will prefer browserify.\n\nBeefy may accept, as a shorthand, `beefy(\"file.js\")` or `beefy([\"file.js\"])`.\n\n## license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisdickinson%2Fbeefy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisdickinson%2Fbeefy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisdickinson%2Fbeefy/lists"}