The following will bundle your script assets with browserify each time a generation write completes. The bundled file will be located at my-website/out/scripts.js
if you are using all the default configuration for your paths.
-
Install Dependencies
npm install --save browserify safeps
-
Add the following to your docpad configuration file
# Write After # Used to bundle the editor writeAfter: (opts,next) -> # Prepare {rootPath, outPath} = @docpad.getConfig() # Bundle the scripts the editor uses together command = """ #{rootPath}/node_modules/.bin/browserify #{outPath}/vendor/jquery.js #{outPath}/scripts/script.js -o #{outPath}/scripts.js """.replace(/\n/g,' ') # Execute require('safeps').exec(command, {cwd:rootPath, output:true}, next) # Chain @
Also need to:
balUtil = require "bal-util"
at the top