Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created September 10, 2020 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbe/7d008655d28c6507d94eeb95e4b39560 to your computer and use it in GitHub Desktop.
Save peterbe/7d008655d28c6507d94eeb95e4b39560 to your computer and use it in GitHub Desktop.
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