Skip to content

Commit 9e58536

Browse files
committed
#182: applying @szarouski fix for npm 3
1 parent 23ef4b4 commit 9e58536

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

Gruntfile.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22
var path = require('path');
33

44
var pathToApp = path.resolve('./');
5+
var parentFolderName = path.basename(path.resolve('..'));
56
global.pathToApp = pathToApp;
67

78
var loadOptions = require('./core/loadOptions');
89

10+
var getLoaderPackageName = function() {
11+
var packageName;
12+
var isSubPackage = parentFolderName === 'node_modules';
13+
if (isSubPackage) {
14+
packageName = 'load-grunt-parent-tasks';
15+
} else {
16+
packageName = 'load-grunt-tasks';
17+
}
18+
return packageName;
19+
};
20+
921
module.exports = function(grunt) {
1022
var appPort = grunt.option('app-port') || 8080;
1123

1224
// load all grunt tasks matching the `grunt-*` pattern
13-
//require('load-grunt-tasks')(grunt);
25+
require(getLoaderPackageName())(grunt);
1426

1527
// measuring processing time
1628
require('time-grunt')(grunt);
@@ -194,20 +206,6 @@ module.exports = function(grunt) {
194206
}
195207
});
196208

197-
// Load plugins
198-
grunt.loadNpmTasks('grunt-autoprefixer');
199-
grunt.loadNpmTasks('grunt-contrib-clean');
200-
grunt.loadNpmTasks('grunt-contrib-copy');
201-
grunt.loadNpmTasks('grunt-contrib-cssmin');
202-
grunt.loadNpmTasks('grunt-contrib-htmlmin');
203-
grunt.loadNpmTasks('grunt-contrib-jshint');
204-
grunt.loadNpmTasks('grunt-contrib-less');
205-
grunt.loadNpmTasks('grunt-contrib-uglify');
206-
grunt.loadNpmTasks('grunt-contrib-watch');
207-
grunt.loadNpmTasks('grunt-jsdoc');
208-
grunt.loadNpmTasks('grunt-newer');
209-
grunt.loadNpmTasks('grunt-mocha-test');
210-
211209
/*
212210
*
213211
* Custom tasks

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"grunt-newer": "~0.6.1",
4646
"gulp-watch": "operatino/gulp-watch#4.3.5-latest-fsevents",
4747
"jsdom": "^1.2.1",
48+
"load-grunt-parent-tasks": "^0.1.1",
4849
"load-grunt-tasks": "~0.3.0",
4950
"lodash": "^3.10.1",
5051
"log4js": "~0.6.20",

0 commit comments

Comments
 (0)