Skip to content

Commit

Permalink
Grunt: Better handling of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Feb 7, 2016
1 parent 22fff84 commit 36692d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
30 changes: 22 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,36 @@

module.exports = function(grunt) {

grunt.file.defaultEncoding = 'utf-8';

//
// Load plugins
//
try {
require('time-grunt')(grunt);
} catch (e) { }

grunt.file.defaultEncoding = 'utf-8';
// Make sure we only load required modules (ignore warnings)
var checks = ['test', 'jshint', 'jscs', 'csslint', 'mochaTest'];
checks.forEach(function(k) {
if ( grunt.cli.tasks.indexOf(k) >= 0 ) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
//grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-csslint');
return false;
}
return true;
});

if ( grunt.cli.tasks.indexOf('nw') >= 0 ) {
grunt.loadNpmTasks('grunt-nw-builder');
}

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
//grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-nw-builder');
if ( grunt.cli.tasks.indexOf('watch') >= 0 ) {
grunt.loadNpmTasks('grunt-contrib-watch');
}

//
// Load tasks
Expand Down
4 changes: 2 additions & 2 deletions doc/NW.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Run:

```shell
# Install all dev dependencies
npm install
# Install NW grunt builder library
npm install grunt-nw-builder

# Make NW build
grunt nw
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"grunt-mocha-test": ">=0.12.7",
"grunt-contrib-watch": ">=0.6.1",
"grunt-contrib-jshint": ">=0.11.3",
"grunt-nw-builder": ">=2.0.0",
"grunt-jscs": ">=2.5.0",
"grunt-contrib-csslint": "~0.5.0"
}
Expand Down

0 comments on commit 36692d3

Please sign in to comment.