Map Sizzle to a path with config to allow users to put Sizzle wherever they want

This commit is contained in:
Timmy Willison 2013-09-10 18:47:36 -05:00
parent 812319093a
commit 5fbf4a4fe3
3 changed files with 11 additions and 3 deletions

View File

@ -26,6 +26,9 @@ module.exports = function( grunt ) {
startFile: "src/intro.js", startFile: "src/intro.js",
endFile: "src/outro.js" endFile: "src/outro.js"
}, },
paths: {
sizzle: "../bower_components/sizzle/dist/sizzle"
},
rawText: {}, rawText: {},
onBuildWrite: convert onBuildWrite: convert
}; };
@ -47,7 +50,7 @@ module.exports = function( grunt ) {
.replace( rdefineEnd, "" ); .replace( rdefineEnd, "" );
// Sizzle treatment // Sizzle treatment
} else if ( /\/sizzle$/.test( name ) ) { } else if ( /^sizzle$/.test( name ) ) {
contents = "var Sizzle =\n" + contents contents = "var Sizzle =\n" + contents
// Remove EXPOSE lines from Sizzle // Remove EXPOSE lines from Sizzle
.replace( /\/\/\s*EXPOSE[\w\W]*\/\/\s*EXPOSE/, "return Sizzle;" ); .replace( /\/\/\s*EXPOSE[\w\W]*\/\/\s*EXPOSE/, "return Sizzle;" );

View File

@ -1,6 +1,6 @@
define([ define([
"./core", "./core",
"../bower_components/sizzle/dist/sizzle" "sizzle"
], function ( jQuery, Sizzle ) { ], function ( jQuery, Sizzle ) {
jQuery.find = Sizzle; jQuery.find = Sizzle;

7
test/jquery.js vendored
View File

@ -28,7 +28,12 @@
// If QUnit is on window, this is the main window // If QUnit is on window, this is the main window
// This detection allows AMD tests to be run in an iframe // This detection allows AMD tests to be run in an iframe
if ( QUnit.urlParams.amd && window.QUnit ) { if ( QUnit.urlParams.amd && window.QUnit ) {
require.config({ baseUrl: path }); require.config({
baseUrl: path,
paths: {
sizzle: path + "bower_components/sizzle/dist/sizzle"
}
});
src = "src/jquery"; src = "src/jquery";
// Include tests if specified // Include tests if specified
if ( typeof loadTests !== "undefined" ) { if ( typeof loadTests !== "undefined" ) {