From ec3f05cb751c724c635bdb3d45f6bc3c03af4fa3 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 20 Mar 2014 12:34:35 -0300 Subject: [PATCH] add monitoring to Gruntfile. updates README --- Gruntfile.js | 35 +++++++++++++++++++++++------------ README.md | 12 +++++++++++- package.json | 2 ++ 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4eca82b..8966d64 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,23 +3,16 @@ module.exports = function(grunt) { //Load NPM tasks - grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-css'); grunt.loadNpmTasks('grunt-markdown'); + grunt.loadNpmTasks('grunt-macreload'); // Project Configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), - jshint: { - all: { - src: ['Gruntfile.js', 'public/src/js/**/*.js'], - options: { - jshintrc: true - } - } - }, concat: { options: { process: function(src, filepath) { @@ -83,15 +76,33 @@ module.exports = function(grunt) { } ] } - } + }, + macreload: { + chrome: { + browser: 'chrome', + editor: 'macvim' + } + }, + watch: { + main: { + files: ['public/src/js/**/*.js'], + tasks: ['concat:main', 'uglify:main', 'macreload'], + }, + css: { + files: ['public/src/css/**/*.css'], + tasks: ['concat:css', 'cssmin', 'macreload'], + }, + }, }); //Making grunt default to force in order not to break the project. grunt.option('force', true); //Default task(s). - grunt.registerTask('default', ['jshint']); + grunt.registerTask('default', ['watch']); //Compile task (concat + minify) - grunt.registerTask('compile', ['concat', 'uglify', 'cssmin']); + grunt.registerTask('compile', ['concat', 'uglify', 'cssmin', 'macreload']); + + }; diff --git a/README.md b/README.md index 669af25..d605ef5 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,20 @@ To compile and minify the web application's assets: ```$ grunt compile``` +There is a convinent Gruntfile.js for automation during editing the code + +```$ grunt``` + +and if you are develping the API also, run: + +```INSIGHT_PUBLIC_PATH=../insight/public grunt``` + +**also** in the insight-api path. (So you will have to grunt process running, one for insight and one for insight-api). + ## Note -For more details about the *insight API* configs and end-poinst, just go to [insight API github repository](https://github.com/bitpay/insight-api) or read the [documentation](https://github.com/bitpay/insight-api/blob/master/README.md) +For more details about the *insight API* configs and end-point, just go to [insight API github repository](https://github.com/bitpay/insight-api) or read the [documentation](https://github.com/bitpay/insight-api/blob/master/README.md) ## Contribute diff --git a/package.json b/package.json index 1ac53b4..5f94454 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,8 @@ "grunt-contrib-jshint": "~0.8.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-uglify": "~0.3.2", + "grunt-contrib-watch": "*", + "grunt-macreload": "*", "grunt-css": "~0.5.4", "grunt-markdown": "~0.5.0" }