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
923bfc80
Commit
923bfc80
authored
Oct 01, 2013
by
Michał Gołębiowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No ticket. Simplify the post-uglify task.
parent
2c0b9027
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
14 deletions
+7
-14
Gruntfile.js
Gruntfile.js
+2
-5
uglify.js
build/tasks/uglify.js
+5
-9
No files found.
Gruntfile.js
View file @
923bfc80
...
@@ -123,12 +123,9 @@ module.exports = function( grunt ) {
...
@@ -123,12 +123,9 @@ module.exports = function( grunt ) {
},
},
"post-uglify"
:
{
"post-uglify"
:
{
all
:
{
all
:
{
files
:
{
src
:
[
"dist/jquery.min.map"
],
"dist/jquery.min.map.tmp"
:
[
"dist/jquery.min.map"
],
"dist/jquery.min.js.tmp"
:
[
"dist/jquery.min.js"
]
},
options
:
{
options
:
{
tempFiles
:
[
"dist/jquery.
min.map.tmp"
,
"dist/jquery.min.js.tmp"
,
"dist/jquery.
pre-min.js"
]
tempFiles
:
[
"dist/jquery.pre-min.js"
]
}
}
}
}
}
}
...
...
build/tasks/uglify.js
View file @
923bfc80
...
@@ -18,10 +18,10 @@ module.exports = function( grunt ) {
...
@@ -18,10 +18,10 @@ module.exports = function( grunt ) {
// Remove the main jQuery banner, it'll be replaced by the new banner anyway.
// Remove the main jQuery banner, it'll be replaced by the new banner anyway.
.
replace
(
/^
\/\*
!
[\W\w]
*
?\*\/\n?
/g
,
""
)
.
replace
(
/^
\/\*
!
[\W\w]
*
?\*\/\n?
/g
,
""
)
// Strip other banners preserving line count.
// Strip other banners preserving line count.
.
replace
(
/^
\/\*
!
(?:
.|
\n)
*
?\*\/\n?
/gm
,
function
(
match
)
{
.
replace
(
/^
\/\*
!
(?:
.|
\n)
*
?\*\/\n?
/gm
,
function
(
match
)
{
return
match
.
replace
(
/
[^\n]
/gm
,
""
);
return
match
.
replace
(
/
[^\n]
/gm
,
""
);
});
});
}).
join
(
"
\n
"
);
}).
join
(
"
\n
"
);
// Write temp file (with optional banner)
// Write temp file (with optional banner)
grunt
.
file
.
write
(
mapping
.
dest
,
(
banner
||
""
)
+
input
);
grunt
.
file
.
write
(
mapping
.
dest
,
(
banner
||
""
)
+
input
);
...
@@ -30,16 +30,12 @@ module.exports = function( grunt ) {
...
@@ -30,16 +30,12 @@ module.exports = function( grunt ) {
// Change the map file to point back to jquery.js instead of jquery.pre-min.js.
// Change the map file to point back to jquery.js instead of jquery.pre-min.js.
// The problem is caused by the pre-uglify task.
// The problem is caused by the pre-uglify task.
// Also, remove temporary files.
grunt
.
registerMultiTask
(
"post-uglify"
,
function
()
{
grunt
.
registerMultiTask
(
"post-uglify"
,
function
()
{
this
.
files
.
forEach
(
function
(
mapping
)
{
this
.
files
.
forEach
(
function
(
mapping
)
{
var
mapFileName
=
mapping
.
src
[
0
];
mapping
.
src
.
forEach
(
function
(
src
)
{
// Rename the file to a temporary name.
fs
.
renameSync
(
mapFileName
,
mapping
.
dest
);
grunt
.
file
.
write
(
mapFileName
,
grunt
.
file
.
read
(
mapping
.
dest
)
// Refer to the source jquery.js, not the temporary jquery.pre-min.js.
// Refer to the source jquery.js, not the temporary jquery.pre-min.js.
.
replace
(
/
\.
pre-min
\.
/g
,
"."
));
grunt
.
file
.
write
(
src
,
grunt
.
file
.
read
(
src
).
replace
(
/
\.
pre-min
\.
/g
,
"."
)
);
});
});
});
// Remove temporary files.
// Remove temporary files.
...
...
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