|
2 | 2 | var path = require('path');
|
3 | 3 |
|
4 | 4 | var pathToApp = path.resolve('./');
|
| 5 | +var parentFolderName = path.basename(path.resolve('..')); |
5 | 6 | global.pathToApp = pathToApp;
|
6 | 7 |
|
7 | 8 | var loadOptions = require('./core/loadOptions');
|
8 | 9 |
|
| 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 | + |
9 | 21 | module.exports = function(grunt) {
|
10 | 22 | var appPort = grunt.option('app-port') || 8080;
|
11 | 23 |
|
12 | 24 | // load all grunt tasks matching the `grunt-*` pattern
|
13 |
| - //require('load-grunt-tasks')(grunt); |
| 25 | + require(getLoaderPackageName())(grunt); |
14 | 26 |
|
15 | 27 | // measuring processing time
|
16 | 28 | require('time-grunt')(grunt);
|
@@ -194,20 +206,6 @@ module.exports = function(grunt) {
|
194 | 206 | }
|
195 | 207 | });
|
196 | 208 |
|
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 |
| - |
211 | 209 | /*
|
212 | 210 | *
|
213 | 211 | * Custom tasks
|
|
0 commit comments