Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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': [
'blueprint.css',
'style.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' }
//index.html
<script src="config.js"></script>
<script src="package.js"></script>
<script>
$packager.use('app.js')
</script>
// $packager.use is how you load your js. Underneath it uses LABjs
$packager.use = function(scriptName){
if($packager.config.mode=='production'){
$LAB.script(scriptName)
} else {
for(var script in $packager.assets[scriptName]) {
if(script.wait) $LAB.script(script.name).wait();
else $LAB.script(script.name);
}
}
}
// 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
Something went wrong with that request. Please try again.