jackal

A JavaScript manager and build tool for NodeJS & ExpressJS

npm install jackal
18 downloads in the last week
72 downloads in the last month

Jackal

The basic

The general structure of a web site during development stage is

<root>
    /less
    /css 
    /javascript * common JS files or AMD modules *
    /otherstaticresource

To make this structure production-ready we should

  • compile *.less file into CSS
  • compress all .css files (and compiles .less) into a unique CSS file
  • compress all plain *.js files and AMD modules

In order to properly deploy new versions of these resources without worrying about cached files, it's a good idea to include the release version in the path of production files. Something like this

<root>
    /css/min/<release_version>/ /* compressed css files */
    /js/min/<release_version>/ /* compressed js files */

The release version is taken from package.json Sadly there's a drawback: since the *.css files changes relative path from development to production, it's not possible to use relative path inside css/less file to reference images

Configuring jackal-mappings

The file

module.exports = {
    paths: {
        ...path object...
        },
    excludeJavascriptFromCheck: [
        '<jsfile>',
        ...
        ],
    docJavascript: [
        '<jsfile>',
        ...
        ],
    rootBasePath: 'myPath/',
    cssBasePath: 'mypath/'
    };

Each JavaScript file path is relative to the folder of the project. For example, for the project located at /web/myproject, file javascript located at /web/project/javascript/myfile.js must be written as 'javascript/myfile.js'

  • docJavascript: list of JavaScript files to be scanned for automatic doc generation
  • excludeJavascriptFromCheck: exclude this list of JavaScript files from JSHint checking (for example third party files)
  • rootBasePath: to be used if the front end files are located inside a directory which is mapped into the root of the web server (for example the '/public' of NodeJS)
  • cssBasePath: to be used if the root of files referenced in the CSS files in production is different (remember, no relative path in CSS file since they are relocated). Suppose inside CSS there are path like /img/myimage.png but all static files will be upladed to a S3 bucket http://s3.amazonaws.com/my_bucket/. The right parameter will be "my_bucket/"

Path object

This object describe

npm loves you