Skip to content

Commit d0d772b

Browse files
committed
Merge pull request #32 from mrjoelkemp/fix_sass
Handle the case when we have both requirejs and browserify configs. Fixe...
2 parents 395d747 + 2466fb8 commit d0d772b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Diff for: helpers/GruntHelper.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,19 @@ module.exports.prototype.getCompileConfig = function (targets) {
6363

6464
// Attaches the watch configuration to the passed grunt configuration
6565
module.exports.prototype.getWatchConfig = function (gruntConfig, extensions) {
66-
var watchConfig = {};
66+
var watchConfig = {},
67+
targets = Object.keys(gruntConfig),
68+
// If we have both types, then the number of configuration
69+
// targets exceeds the number of extensions, so we need to remedy that
70+
hasBothJSModuleTypes = targets.indexOf('browserify') !== -1 &&
71+
targets.indexOf('requirejs') !== -1;
72+
73+
if (hasBothJSModuleTypes) {
74+
extensions.splice(extensions.indexOf('.js') + 1, 0, '.js');
75+
}
6776

6877
// Watch the files for handled extensions
69-
Object.keys(gruntConfig).forEach(function (target, idx) {
78+
targets.forEach(function (target, idx) {
7079
var currentExt = extensions[idx];
7180

7281
// TODO: This should likely be a per-extension setting config

Diff for: helpers/JsHelper.js

-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ JSH.prototype.getSettings = function () {
2121
var that = this;
2222

2323
return this.getRoots().then(function (roots) {
24-
console.log('JSH: Fetched roots')
2524
return q.all(roots.map(that.getModuleType.bind(that)))
2625
.then(function (moduleTypes) {
27-
console.log('JSH: Fetched module types')
28-
2926
return that.generateSettings(roots, moduleTypes);
3027
});
3128
});

Diff for: index.js

-6
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ function onJSChanged() {
298298
// a root file changes: index.js could remove require of lib/index making index.js a root and lib/index a root
299299
// a non-root file changes: b.js is the root and a.js changes to require b.js making it the new root
300300
return this.jsh.getRoots().then(function (roots) {
301-
// console.log('Pulled roots', roots, '\nold roots: ', that.jsh._oldRoots)
302301
return that.jsh.haveRootsChanged(roots);
303302
})
304303
.then(function (haveRootsChanged) {
@@ -312,18 +311,13 @@ function onJSChanged() {
312311

313312
// Need all of the targets to regenerate the gruntfile
314313
return that.getAllSettings().then(function (targets) {
315-
// console.log('Getting config')
316314
return that.engine.getConfig(targets, that.extensions);
317315
})
318316
.then(function (config) {
319317
// Grab the targets for the apps and merge with the existing targets
320318
return that.jsh.getSettings().then(function (settings) {
321-
// console.log('JS Settings: ', settings)
322-
// console.log('JS Settings Target: ', settings.target)
323-
324319
utils.shallowExtend(config, settings.target);
325320

326-
// console.log('Extended Config: ', config)
327321
return config;
328322
});
329323
})

0 commit comments

Comments
 (0)