Skip to content

Commit

Permalink
Restore optIn behavior for builds
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Sep 9, 2013
1 parent d4518ea commit 8791920
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions build/tasks/build.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = function( grunt ) {
startFile: "src/intro.js", startFile: "src/intro.js",
endFile: "src/outro.js" endFile: "src/outro.js"
}, },
rawText: {},
onBuildWrite: convert onBuildWrite: convert
}; };


Expand Down Expand Up @@ -75,6 +76,7 @@ module.exports = function( grunt ) {
var flag, index, var flag, index,
done = this.async(), done = this.async(),
flags = this.flags, flags = this.flags,
optIn = flags[ "*" ],
name = this.data.dest, name = this.data.dest,
minimum = this.data.minimum, minimum = this.data.minimum,
removeWith = this.data.removeWith, removeWith = this.data.removeWith,
Expand Down Expand Up @@ -168,18 +170,15 @@ module.exports = function( grunt ) {
// *:*:-css all except css and dependents (explicit > implicit) // *:*:-css all except css and dependents (explicit > implicit)
// *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency) // *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency)
// *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency) // *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency)
delete flags[ "*" ];
for ( flag in flags ) { for ( flag in flags ) {
if ( flag !== "*" ) { excluder( flag );
excluder( flag );
}
} }


// Handle Sizzle exclusion // Handle Sizzle exclusion
// Replace with selector-native // Replace with selector-native
if ( (index = excluded.indexOf( "sizzle" )) > -1 ) { if ( (index = excluded.indexOf( "sizzle" )) > -1 ) {
config.rawText = { config.rawText.selector = "define(['./selector-native']);";
selector: "define(['./selector-native']);"
};
excluded.splice( index, 1 ); excluded.splice( index, 1 );
} }


Expand Down Expand Up @@ -213,6 +212,12 @@ module.exports = function( grunt ) {
grunt.file.write( name, compiled ); grunt.file.write( name, compiled );
}; };


// Turn off opt-in if necessary
if ( !optIn ) {
// Overwrite the default inclusions with the explicit ones provided
config.rawText.jquery = "define([" + (included.length ? included.join(",") : "") + "]);";
}

// Trace dependencies and concatenate files // Trace dependencies and concatenate files
requirejs.optimize( config, function( response ) { requirejs.optimize( config, function( response ) {
grunt.verbose.writeln( response ); grunt.verbose.writeln( response );
Expand Down

0 comments on commit 8791920

Please sign in to comment.