gdumitrescu
12/6/2013 - 6:38 AM

using `npm run` to build and watch with less and browserify

using npm run to build and watch with less and browserify

The package.json above expects .less files to be in style/, browser code to be in browser/, and static files to be in static/.

To watch the less and js files for development, do:

npm run watch

To build for production, do:

npm run build
{
  "name": "my-app",
  "version": "0.0.0",
  "dependencies": {
    "browserify": "~2.36.1",
    "less": "~1.5.1"
  },
  "devDependencies": {
    "watchify": "~0.4.1",
    "catw": "~0.2.0"
  },
  "scripts": {
    "watch-css": "catw -c 'lessc -' 'style/*.less' -o static/bundle.css -v",
    "watch-js": "watchify browser/*.js -o static/bundle.js -dv",
    "watch": "npm run watch-css & npm run watch-js",
    "build-css": "catw -c 'lessc -' 'style/*.less' > static/bundle.css",
    "build-js": "browserify browser/*.js > static/bundle.js",
    "build": "npm run build-css && npm run build-js"
  }
}