Get your scripts together
AutoPack is still in heavy development. Please file any bugs you find and/or contribute.
$ npm install -g autopack
$ cd my_project$ autopack init
autopack in your console with the following optional flags.
||Specify the location of the autopackfile.|
||Change the current working directory.|
||The HTML file you want AutoPack to work on.|
||The directory you want AutoPack to save the converted files to.|
||Create an autopackfile in the current directory.|
You can configure AutoPack by creating a file named autopackfile.js in the root directory of your project. The default configuration looks like this:
moduleexports =entry: 'index.html'output: 'build'pack:html:name: 'index.html'minify: falsecss:name: 'style.css'local: concat: true minify: trueinline: concat: false minify: truejs:name: 'bundle.js'local: concat: true minify: trueinline: concat: false minify: trueexclude: 'scripts/settings.js'//files found under these patterns will be copied into the output dircopy: 'images/**' '**/*.gif' 'fonts/*.ttf' 'fonts/*.woff' 'fonts/*.otf'//These resources/elements will be removed from the html coderemove:'' '#dev-info' 'debug.css';
AutoPack is still a work in progress. Don't expect it to work rightaway in your project. If you find any issues please report them.
AutoPack can alter the order in which scripts are executed if for example only local scripts are being concatenated. This can result in problems with dependencies in inline scripts. Consider the following scenario:
//settings.jsmySettings = background:'#fff';
The packed version can result in the following HTML:
Now the inline script is not able to find the variable
mySettings (which is being set in