Build: Move the stripJSONComments variable to the function that uses it

This commit is contained in:
Michał Gołębiowski 2016-02-10 12:54:25 +01:00
parent 3f46cec169
commit 991e3f3e2a

View File

@ -2,7 +2,8 @@ module.exports = function( grunt ) {
"use strict"; "use strict";
function readOptionalJSON( filepath ) { function readOptionalJSON( filepath ) {
var data = {}; var stripJSONComments = require( "strip-json-comments" ),
data = {};
try { try {
data = JSON.parse( stripJSONComments( data = JSON.parse( stripJSONComments(
fs.readFileSync( filepath, { encoding: "utf8" } ) fs.readFileSync( filepath, { encoding: "utf8" } )
@ -12,7 +13,6 @@ module.exports = function( grunt ) {
} }
var fs = require( "fs" ), var fs = require( "fs" ),
stripJSONComments = require( "strip-json-comments" ),
gzip = require( "gzip-js" ), gzip = require( "gzip-js" ),
srcHintOptions = readOptionalJSON( "src/.jshintrc" ), srcHintOptions = readOptionalJSON( "src/.jshintrc" ),
newNode = !/^v0/.test( process.version ), newNode = !/^v0/.test( process.version ),