Pull in the Sizzle library dynamically using a submodule and make it part of the jQuery build process.

This commit is contained in:
John Resig 2009-10-26 18:23:31 -04:00
parent bbffc99f7c
commit 81f65ce339
6 changed files with 32 additions and 1022 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "test/qunit"]
path = test/qunit
url = git://github.com/jquery/qunit.git
[submodule "src/sizzle"]
path = src/sizzle
url = git://github.com/jeresig/sizzle.git

View file

@ -2,7 +2,6 @@ SRC_DIR = src
BUILD_DIR = build
PREFIX = .
TEST_DIR = ${PREFIX}/test
DIST_DIR = ${PREFIX}/dist
BASE_FILES = ${SRC_DIR}/core.js\
@ -33,18 +32,24 @@ MINJAR = java -jar ${BUILD_DIR}/yuicompressor-2.4.2.jar
DATE=`git log -1 | grep Date: | sed 's/[^:]*: *//'`
all: jquery test min
all: jquery min
@@echo "jQuery build complete."
${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
jquery: ${DIST_DIR} ${JQ}
init:
@@echo "Grabbing external dependencies..."
@@git submodule init
@@git submodule update
jquery: ${DIST_DIR} selector ${JQ}
${JQ}: ${MODULES}
@@echo "Building" ${JQ}
@@mkdir -p ${DIST_DIR}
@@cat ${MODULES} | \
sed 's/Date:./&'"${DATE}"'/' | \
${VER} > ${JQ};
@ -52,6 +57,10 @@ ${JQ}: ${MODULES}
@@echo ${JQ} "Built"
@@echo
selector: init
@@echo "Building selector code from Sizzle"
@@sed '/EXPOSE/r src/sizzle-jquery.js' src/sizzle/sizzle.js > src/selector.js
min: ${JQ_MIN}
${JQ_MIN}: ${JQ}
@ -63,13 +72,9 @@ ${JQ_MIN}: ${JQ}
@@echo ${JQ_MIN} "Built"
@@echo
test: ${JQ}
@@echo "Building Test Suite"
@@echo "Test Suite Built"
@@echo
git submodule init
git submodule update
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}
@@echo "Removing built copy of Sizzle"
@@rm src/selector.js

12
README
View file

@ -24,11 +24,14 @@ What you need to build your own jQuery:
How to build your own jQuery:
In the main directory of the distribution (the one that this file is in), type
the following to make all versions of jQuery, the documentation, and the test suite:
the following to make all versions of jQuery:
make
Here are each of the individual items that are buildable from the Makefile.
make init
Pull in all the external dependencies (QUnit, Sizzle) for the project.
make jquery
The standard, uncompressed, jQuery code.
Makes: ./dist/jquery.js
@ -37,10 +40,9 @@ make min
A compressed version of jQuery (made the YUI Minifier).
Makes: ./dist/jquery.min.js
make test
Makes sure that the QUnit submodule is properly checked out.
Open this file in your browser:
./test/index.html
make selector
Builds the selector library for jQuery from Sizzle.
Makes: ./src/selector.js
Finally, you can remove all the built files using the command:
make clean

File diff suppressed because it is too large Load diff

1
src/sizzle Submodule

@ -0,0 +1 @@
Subproject commit 3e97c27d19e18c984a29bfea89fcccadf3544fb3

6
src/sizzle-jquery.js Normal file
View file

@ -0,0 +1,6 @@
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
return;