mirror of
https://github.com/danog/inline-critical.git
synced 2024-11-26 20:14:41 +01:00
Merge pull request #260 from XhmikosR/master-resolve
Remove resolve dependency.
This commit is contained in:
commit
c128a17e86
@ -46,7 +46,6 @@
|
||||
"postcss-discard": "^0.3.2",
|
||||
"prettier": "^1.18.2",
|
||||
"reaver": "^2.0.0",
|
||||
"resolve": "^1.12.0",
|
||||
"slash": "^3.0.0",
|
||||
"uglify-js": "^3.6.4"
|
||||
},
|
||||
|
@ -3,20 +3,19 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const {JSDOM} = require('jsdom');
|
||||
const resolve = require('resolve');
|
||||
const detectIndent = require('detect-indent');
|
||||
const flatten = require('lodash/flatten');
|
||||
const UglifyJS = require('uglify-js');
|
||||
|
||||
const loadCssMain = require.resolve('fg-loadcss');
|
||||
|
||||
/**
|
||||
* Get loadcss + cssrelpreload script
|
||||
*
|
||||
* @returns {string} Minified loadcss script
|
||||
*/
|
||||
function getScript() {
|
||||
const loadCssMain = resolve.sync('fg-loadcss');
|
||||
const loadCssBase = path.dirname(loadCssMain);
|
||||
const loadCSS = fs.readFileSync(path.join(loadCssBase, 'cssrelpreload.js'), 'utf8');
|
||||
const loadCSS = fs.readFileSync(path.join(path.dirname(loadCssMain), 'cssrelpreload.js'), 'utf8');
|
||||
|
||||
return UglifyJS.minify(loadCSS).code.trim();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user