Node.js - Frontend Deployer (JavaScript)

Application project
02 September 2014


The node.js Frontend Deployer is a small little deployment script that i created to make it easy to setup and deploy small webprojects. The script concatinates and minifies all files spesified inside the config file (package.json), together with some other functionalities.

Node.js is needed to be able to run the files


Combine your projects JS and CSS files to a deployment file ready for production.

To get started make sure you have installed the npm dependencies:

Stand on the folder that contains package.json and type in the node.js:
npm install

Set up the package.json to fit your project. This is your projects configuration file

When you are ready to deploy you can execute the script with:
node frontend.js deploy

JS/CSS imports

You can set up the main files that you would like to compress in the package.json.

Note that you can specify multiple files as "in"-files that will be combined to one "out"-file

"css" : [
{ "in" : "css/modules/header.css" },
{ "in" : "css/modules/progress.css" },
{ "out" : "header-min.css" }
"js" : [
{ "in" : "js/classes/admin.js" },
{ "out" : "admin-min.js" }

You can also specify some import strings that the deployer script will look for:

"cssIncludes" : "@import",
"jsIncludes" : "@import",

If used and found it will concatenate the included file(s) (recursive looping) into the finnished "out"-file. If multiple includes of the same file is found, only one will be used in the "out"-file. If you use JS includes inside your other JS files (and not just stick with the package.json), the format of the input should be kept on one line and look like this:

/* @import banner.js */


Setup the buildfooter.js to suit your liking (will be added at the bottom of all files). If you would like to add more fields to the buildfooter.js make sure the new fields are matched with some type of text in the package.json

You have to be logged in to download the project files!
If you are interested in the project files then contact me