Skip to content

Instantly share code, notes, and snippets.

@dcherman
Created November 15, 2012 18:12
Show Gist options
  • Select an option

  • Save dcherman/4080211 to your computer and use it in GitHub Desktop.

Select an option

Save dcherman/4080211 to your computer and use it in GitHub Desktop.
// JSHint chokes when a UTF8 file is read that includes the BOM.
// This bug is fixed in grunt versions >= 0.4, but include the fix
// for previous versions as well since 0.4 is still in development / unstable.
// https://github.com/cowboy/grunt/issues/338
// https://github.com/cowboy/grunt/commit/44b57274ceba147e24dcc121ed7d9b84e6ec4e49
if ( parseFloat(grunt.version) < 0.4 ) {
var _readFile = grunt.file.read;
grunt.file.read = function() {
var src = _readFile.apply( this, arguments );
if (typeof src === 'string' && src.charCodeAt(0) === 0xFEFF) {
src = src.substring(1);
}
return src;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment