Created
September 10, 2020 12:55
-
-
Save peterbe/7d008655d28c6507d94eeb95e4b39560 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var csso = require("csso"); | |
var node_sass = require("node-sass"); | |
var sass = require("sass"); | |
var scss_filename = "/Users/peterbe/yari/client/src/kumastyles/react-mdn.scss"; | |
var fsize = (b) => `${(b / 1024.0).toFixed(0)}kb`; | |
function run(name, func) { | |
var t0 = new Date(); | |
func.render({ file: scss_filename }, function (err, result) { | |
var t1 = new Date(); | |
console.assert(!err, err); | |
var css = result.css.toString(); | |
var minifiedCss = csso.minify(css).css; | |
console.log( | |
name, | |
`took ${t1 - t0}ms`, | |
"result", | |
fsize(css.length), | |
fsize(minifiedCss.length) | |
); | |
}); | |
} | |
// run("node-sass", node_sass); | |
run("sass", sass); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment