Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
f13de6b3
Commit
f13de6b3
authored
Jun 12, 2012
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the terminal command args syntax for custom builds. Update README
parent
47298a7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
12 deletions
+81
-12
README.md
README.md
+14
-5
grunt.js
grunt.js
+67
-7
No files found.
README.md
View file @
f13de6b3
...
@@ -75,6 +75,7 @@ The built version of jQuery will be put in the `dist/` subdirectory.
...
@@ -75,6 +75,7 @@ The built version of jQuery will be put in the `dist/` subdirectory.
Starting in jQuery 1.8, special builds can now be created that optionally exclude or include any of the following modules:
Starting in jQuery 1.8, special builds can now be created that optionally exclude or include any of the following modules:
-
ajax
-
ajax
-
css
-
dimensions
-
dimensions
-
effects
-
effects
-
offset
-
offset
...
@@ -85,34 +86,42 @@ To create a custom build, use the following special `grunt` commands:
...
@@ -85,34 +86,42 @@ To create a custom build, use the following special `grunt` commands:
Exclude
**ajax**
:
Exclude
**ajax**
:
```
bash
```
bash
grunt build:
*
:
*
:-ajax
grunt custom:-ajax
```
Exclude
**css**
:
```
bash
grunt custom:-css
```
```
Exclude
**dimensions**
:
Exclude
**dimensions**
:
```
bash
```
bash
grunt
build:
*
:
*
:-dimensions
grunt
custom
:-dimensions
```
```
Exclude
**effects**
:
Exclude
**effects**
:
```
bash
```
bash
grunt
build:
*
:
*
:-effects
grunt
custom
:-effects
```
```
Exclude
**offset**
:
Exclude
**offset**
:
```
bash
```
bash
grunt
build:
*
:
*
:-offset
grunt
custom
:-offset
```
```
Exclude
**all**
optional modules:
Exclude
**all**
optional modules:
```
bash
```
bash
grunt
build:
*
:
*
:-ajax:-dimensions:-effects:
-offset
grunt
custom:-ajax,-css,-dimensions,-effects,
-offset
```
```
Note: dependencies will be handled internally, by the build process.
Running the Unit Tests
Running the Unit Tests
--------------------------------------
--------------------------------------
...
...
grunt.js
View file @
f13de6b3
...
@@ -181,7 +181,41 @@ module.exports = function( grunt ) {
...
@@ -181,7 +181,41 @@ module.exports = function( grunt ) {
});
});
// Special "alias" task to make custom build creation less grawlix-y
grunt
.
registerTask
(
"custom"
,
function
()
{
var
done
=
this
.
async
(),
args
=
[].
slice
.
call
(
arguments
),
modules
=
args
.
length
?
args
[
0
].
replace
(
/,/g
,
":"
)
:
""
;
// Translation example
//
// grunt build:+ajax,-dimensions,-effects,-offset
//
// Becomes:
//
// grunt build:*:*:-ajax:-dimensions:-effects:-offset
grunt
.
log
.
writeln
(
"Creating custom build...
\n
"
);
grunt
.
utils
.
spawn
({
cmd
:
"grunt"
,
args
:
[
"build:*:*:"
+
modules
]
},
function
(
err
,
result
)
{
if
(
err
)
{
grunt
.
verbose
.
error
();
done
(
err
);
return
;
}
grunt
.
log
.
writeln
(
result
.
replace
(
"Done, without errors."
,
""
)
);
done
();
});
});
// Special concat/build task to handle various jQuery build requirements
// Special concat/build task to handle various jQuery build requirements
//
grunt
.
registerMultiTask
(
grunt
.
registerMultiTask
(
"build"
,
"build"
,
"Concatenate source (include/exclude modules with +/- flags), embed date/version"
,
"Concatenate source (include/exclude modules with +/- flags), embed date/version"
,
...
@@ -190,6 +224,7 @@ module.exports = function( grunt ) {
...
@@ -190,6 +224,7 @@ module.exports = function( grunt ) {
var
i
,
var
i
,
compiled
=
""
,
compiled
=
""
,
modules
=
this
.
flags
,
modules
=
this
.
flags
,
explicit
=
Object
.
keys
(
modules
).
length
>
1
,
optIn
=
!
modules
[
"*"
],
optIn
=
!
modules
[
"*"
],
name
=
this
.
file
.
dest
,
name
=
this
.
file
.
dest
,
excluded
=
{},
excluded
=
{},
...
@@ -208,6 +243,7 @@ module.exports = function( grunt ) {
...
@@ -208,6 +243,7 @@ module.exports = function( grunt ) {
}
}
};
};
// figure out which files to exclude based on these rules in this order:
// figure out which files to exclude based on these rules in this order:
// explicit > implicit (explicit also means a dependency/dependent that was explicit)
// explicit > implicit (explicit also means a dependency/dependent that was explicit)
// exclude > include
// exclude > include
...
@@ -215,9 +251,9 @@ module.exports = function( grunt ) {
...
@@ -215,9 +251,9 @@ module.exports = function( grunt ) {
// *: none (implicit exclude)
// *: none (implicit exclude)
// *:* all (implicit include)
// *:* all (implicit include)
// *:*:-effects all except effects (explicit > implicit)
// *:*:-effects all except effects (explicit > implicit)
// *:*:-css all except css and it
'
s deps (explicit)
// *:*:-css all except css and its deps (explicit)
// *:*:-css:+effects all except css and it
'
s deps (explicit exclude from dep. trumps explicit include)
// *:*:-css:+effects all except css and its deps (explicit exclude from dep. trumps explicit include)
// *:+effects none except effects and it
'
s deps (explicit include from dep. trumps implicit exclude)
// *:+effects none except effects and its deps (explicit include from dep. trumps implicit exclude)
this
.
file
.
src
.
forEach
(
function
(
filepath
)
{
this
.
file
.
src
.
forEach
(
function
(
filepath
)
{
var
flag
=
filepath
.
flag
;
var
flag
=
filepath
.
flag
;
...
@@ -236,13 +272,37 @@ module.exports = function( grunt ) {
...
@@ -236,13 +272,37 @@ module.exports = function( grunt ) {
// conditionally concatenate source
// conditionally concatenate source
this
.
file
.
src
.
forEach
(
function
(
filepath
)
{
this
.
file
.
src
.
forEach
(
function
(
filepath
)
{
var
flag
=
filepath
.
flag
;
var
flag
=
filepath
.
flag
,
specified
=
false
,
message
=
""
;
if
(
flag
)
{
if
(
flag
)
{
if
(
excluded
[
flag
]
!==
undefined
)
{
if
(
excluded
[
flag
]
!==
undefined
)
{
log
.
writeln
(
"Excluding "
+
flag
+
": '"
+
filepath
.
src
+
"'."
);
message
=
(
"Excluding "
+
flag
).
red
;
return
;
specified
=
true
;
}
else
{
message
=
(
"Including "
+
flag
).
green
;
// If this module was actually specified by the
// builder, then st the flag to include it in the
// output list
if
(
modules
[
"+"
+
flag
]
)
{
specified
=
true
;
}
}
}
log
.
writeln
(
"Including "
+
flag
+
": '"
+
filepath
.
src
+
"'."
);
// Only display the inclusion/exclusion list when handling
// an explicit list.
//
// Additionally, only display modules that have been specified
// by the user
if
(
explicit
&&
specified
)
{
grunt
.
log
.
writetableln
([
27
,
30
],
[
message
,
(
"("
+
filepath
.
src
+
")"
).
grey
]);
}
filepath
=
filepath
.
src
;
filepath
=
filepath
.
src
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment