some cleanup

This commit is contained in:
Ben Zörb 2014-12-08 23:15:13 +01:00
parent 95606c5cda
commit be3889c1cf

View File

@ -19,21 +19,28 @@ var cheerio = require('cheerio');
var CleanCSS = require('clean-css');
var slash = require('slash');
var normalizeNewline = require('normalize-newline');
// get loadCSS
var loadCSS = read(path.join(__dirname,'vendor','loadCSS.js'));
loadCSS = UglifyJS.minify(loadCSS, {fromString: true}).code;
/**
* Fixup slashes in file paths for windows
* @param {string} str
* @return {string}
*/
function normalizePath(str) {
return process.platform === 'win32' ? slash(str) : str;
}
/**
* Read file *
* @param {string} file
* @returns {string}
*/
function read (file) {
return fs.readFileSync(file, 'utf8');
}
var loadCSS = read(path.join(__dirname,'vendor','loadCSS.js'));
loadCSS = UglifyJS.minify(loadCSS, {fromString: true}).code;
@ -82,7 +89,7 @@ module.exports = function(html, styles, options) {
noscript.append('\n');
});
// build js block to load blocking stylesheets
// build js block to load blocking stylesheets and insert it right before
$(noscript).before('<script>\n' +
'(function(u){' +
loadCSS +