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
b8487664
Commit
b8487664
authored
Dec 22, 2012
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Post-process map file so it has the right path.
parent
3e1589db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
32 deletions
+29
-32
Gruntfile.js
Gruntfile.js
+29
-32
No files found.
Gruntfile.js
View file @
b8487664
...
@@ -4,7 +4,8 @@ module.exports = function( grunt ) {
...
@@ -4,7 +4,8 @@ module.exports = function( grunt ) {
var
distpaths
=
[
var
distpaths
=
[
"dist/jquery.js"
,
"dist/jquery.js"
,
"dist/jquery.min.js"
"dist/jquery.min.js"
,
"dist/jquery.min.map"
],
],
readOptionalJSON
=
function
(
filepath
)
{
readOptionalJSON
=
function
(
filepath
)
{
var
data
=
{};
var
data
=
{};
...
@@ -96,7 +97,7 @@ module.exports = function( grunt ) {
...
@@ -96,7 +97,7 @@ module.exports = function( grunt ) {
},
},
options
:
{
options
:
{
banner
:
"/*! jQuery v<%= pkg.version %> jquery.com | jquery.org/license */"
,
banner
:
"/*! jQuery v<%= pkg.version %> jquery.com | jquery.org/license */"
,
sourceMap
:
"
dist/jquery.source-map.js
"
,
sourceMap
:
"
jquery.min.map
"
,
beautify
:
{
beautify
:
{
ascii_only
:
true
ascii_only
:
true
}
}
...
@@ -220,7 +221,7 @@ module.exports = function( grunt ) {
...
@@ -220,7 +221,7 @@ module.exports = function( grunt ) {
grunt
.
util
.
spawn
({
grunt
.
util
.
spawn
({
cmd
:
process
.
platform
===
"win32"
?
"grunt.cmd"
:
"grunt"
,
cmd
:
process
.
platform
===
"win32"
?
"grunt.cmd"
:
"grunt"
,
args
:
[
"build:*:*:"
+
modules
,
"uglify"
]
args
:
[
"build:*:*:"
+
modules
,
"uglify"
,
"dist"
]
},
function
(
err
,
result
)
{
},
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
grunt
.
verbose
.
error
();
grunt
.
verbose
.
error
();
...
@@ -387,7 +388,7 @@ module.exports = function( grunt ) {
...
@@ -387,7 +388,7 @@ module.exports = function( grunt ) {
grunt
.
log
.
writeln
(
"File '"
+
name
+
"' created."
);
grunt
.
log
.
writeln
(
"File '"
+
name
+
"' created."
);
});
});
//
Allow custom dist file locations
//
Process files for distribution
grunt
.
registerTask
(
"dist"
,
function
()
{
grunt
.
registerTask
(
"dist"
,
function
()
{
var
flags
,
paths
,
stored
;
var
flags
,
paths
,
stored
;
...
@@ -408,47 +409,43 @@ module.exports = function( grunt ) {
...
@@ -408,47 +409,43 @@ module.exports = function( grunt ) {
nonascii
=
false
;
nonascii
=
false
;
distpaths
.
forEach
(
function
(
filename
)
{
distpaths
.
forEach
(
function
(
filename
)
{
var
buf
=
fs
.
readFileSync
(
filename
,
"utf8"
),
var
text
=
fs
.
readFileSync
(
filename
,
"utf8"
),
i
,
c
;
i
,
c
;
if
(
buf
.
length
!==
Buffer
.
byteLength
(
buf
,
"utf8"
)
)
{
if
(
text
.
length
!==
Buffer
.
byteLength
(
text
,
"utf8"
)
)
{
grunt
.
log
.
writeln
(
filename
+
": Non-ASCII characters detected:"
);
grunt
.
log
.
writeln
(
filename
+
": Non-ASCII characters detected:"
);
for
(
i
=
0
;
i
<
buf
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
text
.
length
;
i
++
)
{
c
=
buf
.
charCodeAt
(
i
);
c
=
text
.
charCodeAt
(
i
);
if
(
c
>
127
)
{
if
(
c
>
127
)
{
grunt
.
log
.
writeln
(
"- position "
+
i
+
": "
+
c
);
grunt
.
log
.
writeln
(
"- position "
+
i
+
": "
+
c
);
grunt
.
log
.
writeln
(
"-- "
+
buf
.
substring
(
i
-
20
,
i
+
20
)
);
grunt
.
log
.
writeln
(
"-- "
+
text
.
substring
(
i
-
20
,
i
+
20
)
);
nonascii
=
true
;
nonascii
=
true
;
break
;
}
}
}
}
}
}
});
if
(
nonascii
)
{
return
false
;
}
// Proceed only if there are actual
// Modify map so that it points to files in the same folder;
// paths to write to
// see https://github.com/mishoo/UglifyJS2/issues/47
if
(
paths
.
length
)
{
if
(
/
\.
map$/
.
test
(
filename
)
)
{
text
=
text
.
replace
(
/"dist
\/
/g
,
"
\"
"
);
// 'distpaths' is declared at the top of the
fs
.
writeFileSync
(
filename
,
text
,
"utf-8"
);
// module.exports function scope. It is an array
}
// of default files that jQuery creates
distpaths
.
forEach
(
function
(
filename
)
{
paths
.
forEach
(
function
(
path
)
{
var
created
;
if
(
!
/
\/
$/
.
test
(
path
)
)
{
path
+=
"/"
;
}
created
=
path
+
filename
.
replace
(
"dist/"
,
""
);
// Optionally copy dist files to other locations
paths
.
forEach
(
function
(
path
)
{
var
created
;
grunt
.
file
.
write
(
created
,
grunt
.
file
.
read
(
filename
)
);
if
(
!
/
\/
$/
.
test
(
path
)
)
{
path
+=
"/"
;
}
grunt
.
log
.
writeln
(
"File '"
+
created
+
"' created."
);
created
=
path
+
filename
.
replace
(
"dist/"
,
""
);
});
grunt
.
file
.
write
(
created
,
text
);
grunt
.
log
.
writeln
(
"File '"
+
created
+
"' created."
);
});
});
}
});
return
!
nonascii
;
});
});
// Load grunt tasks from NPM packages
// Load grunt tasks from NPM packages
...
...
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