Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Psuedo code for a JS/CSS packager for static HTML apps
//manifest.js: defines the grouping of js/css
var $packager.assets = {
'app.js': [
{ name:'jquery.js', wait:true },
{ name:'sfasdf.js', wait:true },
{ name:'fasdt.js', wait:true }
'app.css': [
// config.js: defines the environment you're currently in.
// if mode == development, non-minified/non-compressed js files are loaded,
// else if mode == production, only the minified/compressed version is loaded
var $packager.config = { mode: 'development' }
<script src="config.js"></script>
<script src="package.js"></script>
// $packager.use is how you load your js. Underneath it uses LABjs
$packager.use = function(scriptName){
} else {
for(var script in $packager.assets[scriptName]) {
if(script.wait) $LAB.script(;
else $LAB.script(;
// of course we need a CLI based builder that will spit out
// compressed/minified versions of the js/css defined in
// the manifest.js
// $ node build.js manifest.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment