node package manager


Live assets packer with uglify/less/htmlminifier with live reload support


In our project firectory, the best is to create a folder called 'packer' at the project root. In the folder, create a file 'index.js' and copy the sample code to it.

By default, the sample code will move his working directory to the project root process.chdir(path.normalize(__dirname+'/../')) ;

workingDir variable will be the root of your project.

  • packages : could be an object like in sample code or a json file

Run it by being placed in your root directory and call

node packer/
// Test if packer is installed
try {
} catch(e) {
    console.error("g33k-packer package is not installed!\nPlease run `npm update` in the directory.");
// Load libs
var path = require('path'),
fs = require('fs'),
Packer = require('g33k-packer'); 
// Change working path
process.chdir(path.normalize(__dirname+'/../')) ;
// Get working dir
var workingDir = process.cwd();
// Create Packer Instance
var packer = new Packer(workingDir, {
// Debug
debug: false,
// Paths to scan in the working dir
"scanPath": ["/app", "/public/assets"],
// Only work on thoses extensions
"scanExt": /\.(html|js|css|tpl|less)$/i,
// Ignore files with regexp filters applied to full path
"scanIgnore": /(tmp\/|server-.*\.js)/,
// Packed path
"packedPath": "/public/packed",
// Minify options
"minifyJS": true,
"minifyCSS": true,
"minifyHTML": true,
// Watch for file updates every (in ms)
"watch": 500,
// Copy minfied unit files to packedPath
"copy": false,
// Enable livereload support 
"livereload": true,
// Declare packages
"packages": {
// Main CSS file (will be placed to packedPath/app.min.css)
"/app.min.css": [
// Main JS file (will be placed to packedPath/app.min.js)
"/app.min.js": [