Railgun guides your client-side app from development to production. Bundles and optimizes your assets. Separates dev and production environment.
npm install railgun
|4||downloads in the last month|
|Version||0.1.2 last updated 2 years ago|
|Dependencies (11)||commander, csso, express, mime, tilt, envv, jsdom, uglify-js, async, findit, wrench|
Railgun guides your client-side app from development to production. Bundles and optimizes your assets. Separates dev and production environment. Simplifies working with public and private CDNs.
Railgun is highly experimental, alpha, under heavy development, however you'd like to call it. Please don't use this... yet.
- Packages up a client-side app for easy distribution through a CDN or faster serving on your own hardware: minification, concatenation, all that good stuff.
- Filters out code you only need during development and includes code you only need in production, flagged through
- Finds and replaces references to common libraries like jQuery with the equivalent from a public CDN like cdnjs.com or the Google Libraries CDN.
Railgun doesn't require any configuration and works with any project structure. Railgun can work standalone, but you can also use it from Draughtsman. Draughtsman integrates with Railgun to give you a full-blown local web server and static site builder, built from the ground up to simplify front-end engineers' workflows.
It is also the engine behind a couple of other projects:
- Hector, a nascent Jekyll-like static site generation framework -- ideal if you're not just optimizing an app but want to use Railgun to build a promotional site or to run your blog.
- Backbone-express, a server for your Backbone applications that provides a node.js compatibility layer so Backbone routes and view renders work server-side too.
You can integrate Railgun into your own apps.
- Give Railgun a library name or path, and it'll return CDN urls it knows of that have that library (doing HEAD requests so it's always up to date, though with a nocheck parameter so you can use it if offline or if you know your libraries are available at cdnjs.com.)
Point the Railgun command line interface to an HTML file or directory and it will output a nicely optimized version in a directory of your choice. If for whatever weird reason the Railgun cache is corrupted, just run
# build your app (always does a clean build and empties the build dir first)
-o --output # output dir
-s --sources # add additional CDN sources (in order of preference)
# draughtsman will respect `data-railgun-environment` and, being a dev server,
# strip out scripts that target the production environment; but railgun
# also has its own server, which (as opposed to draughtsman) is as plain to
# a regular file server as possible, and serves mainly to test out if there are
# no errors in the packaging process or in your code that targets the production
# environment only
# We want to encourage people to use draughtsman, but railgun should be able to stand
# on its own.
-e --environment # production by default
-f --follow # serves an endpoint that a GitHub post-commit hook
# can POST to, which prompts Railgun to fetch the latest
# commit from said repository and rebuild the app/site
# [also works on railgun build, which turns that command
# into a long-lived process]
railgun clean and you'll have a fresh, empty cache.
Point the Railgun command line interface to an HTML file or directory and it will output a nicely optimized version in a directory of your choice.
If for whatever weird reason the Railgun cache is corrupted, just run