aboutsummaryrefslogtreecommitdiffstats
path: root/grunt.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2012-10-11 10:17:24 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-10-11 10:25:43 -0400
commit1450305402ee8f36825fd5fa44df913a3be2f4c8 (patch)
treef718d9bc601d827a946f8560369336819a6f1c97 /grunt.js
parent798a7a7ea2cb612411b3d9fd87e8b0e894b27de8 (diff)
downloadjquery-1450305402ee8f36825fd5fa44df913a3be2f4c8.tar.gz
jquery-1450305402ee8f36825fd5fa44df913a3be2f4c8.zip
Use the correct escape for BOM; add build code to detect non-ASCII.
Diffstat (limited to 'grunt.js')
-rw-r--r--grunt.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/grunt.js b/grunt.js
index 53d990fb0..7ccf49f95 100644
--- a/grunt.js
+++ b/grunt.js
@@ -416,6 +416,27 @@ module.exports = function( grunt ) {
return path !== "*";
});
+ // Ensure the dist files are pure ASCII
+ var fs = require("fs"),
+ nonascii = false;
+ distpaths.forEach(function( filename ) {
+ var buf = fs.readFileSync( filename, "utf8" ),
+ i, c;
+ if ( buf.length !== Buffer.byteLength( buf, "utf8" ) ) {
+ log.writeln( filename + ": Non-ASCII characters detected:" );
+ for ( i = 0; i < buf.length; i++ ) {
+ c = buf.charCodeAt( i );
+ if ( c > 127 ) {
+ log.writeln( "- position " + i + ": " + c );
+ log.writeln( "-- " + buf.substring( i - 20, i + 20 ) );
+ nonascii = true;
+ }
+ }
+ }
+ });
+ if ( nonascii ) {
+ return false;
+ }
// Proceed only if there are actual
// paths to write to