Skip to content

Commit 0c98b50

Browse files
committed
#182: fix npm 2
1 parent 206c23d commit 0c98b50

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Gruntfile.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
'use strict';
22
var path = require('path');
3+
var fs = require('fs');
34

45
var pathToApp = path.resolve('./');
5-
var parentFolderName = path.basename(path.resolve('..'));
66
global.pathToApp = pathToApp;
77

88
var loadOptions = require('./core/loadOptions');
99

10+
// NPM 3 compatibility fix
1011
var getLoaderPackageName = function() {
1112
var packageName;
13+
var parentFolderName = path.basename(path.resolve('..'));
1214
var isSubPackage = parentFolderName === 'node_modules';
13-
if (isSubPackage) {
15+
var isLocalDepsAvailable = fs.existsSync('node_modules/grunt-autoprefixer') && fs.existsSync('node_modules/grunt-contrib-cssmin');
16+
17+
if (isSubPackage && !isLocalDepsAvailable) {
1418
packageName = 'load-grunt-parent-tasks';
1519
} else {
1620
packageName = 'load-grunt-tasks';
1721
}
22+
1823
return packageName;
1924
};
2025

0 commit comments

Comments
 (0)