aboutsummaryrefslogtreecommitdiffstats
path: root/Gruntfile.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2013-01-06 12:01:22 -0500
committerDave Methvin <dave.methvin@gmail.com>2013-01-06 12:01:22 -0500
commitb45c775ca971afab0c915fbc91aa8720a639f5d1 (patch)
tree0d52c9add000bc3b84466846daf8e95ef2c001bb /Gruntfile.js
parenta95f35744aff95a446cc05e1d8c558b3a4867836 (diff)
downloadjquery-b45c775ca971afab0c915fbc91aa8720a639f5d1.tar.gz
jquery-b45c775ca971afab0c915fbc91aa8720a639f5d1.zip
Fix #12471. Use consistent line endings in jquery.js
Diffstat (limited to 'Gruntfile.js')
-rw-r--r--Gruntfile.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index ea51d180a..0c2c8bb93 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -189,8 +189,8 @@ module.exports = function( grunt ) {
grunt.verbose.write("Injected sizzle-jquery.js into sizzle.js");
- // Write concatenated source to file
- grunt.file.write( name, compiled );
+ // Write concatenated source to file, and ensure newline-only termination
+ grunt.file.write( name, compiled.replace( /\x0d\x0a/g, "\x0a" ) );
// Fail task if errors were logged.
if ( this.errorCount ) {
@@ -409,8 +409,16 @@ module.exports = function( grunt ) {
nonascii = false;
distpaths.forEach(function( filename ) {
- var text = fs.readFileSync( filename, "utf8" ),
- i, c;
+ var i, c,
+ text = fs.readFileSync( filename, "utf8" );
+
+ // Ensure files use only \n for line endings, not \r\n
+ if ( /\x0d\x0a/.test( text ) ) {
+ grunt.log.writeln( filename + ": Incorrect line endings (\\r\\n)" );
+ nonascii = true;
+ }
+
+ // Ensure only ASCII chars so script tags don't need a charset attribute
if ( text.length !== Buffer.byteLength( text, "utf8" ) ) {
grunt.log.writeln( filename + ": Non-ASCII characters detected:" );
for ( i = 0; i < text.length; i++ ) {
@@ -418,10 +426,10 @@ module.exports = function( grunt ) {
if ( c > 127 ) {
grunt.log.writeln( "- position " + i + ": " + c );
grunt.log.writeln( "-- " + text.substring( i - 20, i + 20 ) );
- nonascii = true;
break;
}
}
+ nonascii = true;
}
// Modify map so that it points to files in the same folder;