PurifyCss 没有按预期工作,因为我正在使用 .net 项目我想删除未使用的 css。这是我所做的步骤。
- 我使用节点安装了净化
- 这是我的 .js 用于 purifycss
- 生成输出文件但没有减少 css
这是我收到的信息
PurifyCSS has reduced the file size by ~ NaN%
const purify = require("purify-css")
let content = ['*.cshtml'];
// Glob pattern to ref all HTML files from root directory.
let css = ['/Assets/stylesheets/main.css'];
// Glob pattern to ref all CSS files from root directory.
let options = {
// Will write purified CSS to this file.
output: 'purified.css',
// Output file name
minify: true,
// Will minify CSS code in addition to purify.
info: true,
// Output information on how much reduction was achieved,
rejected: true
// Logs out removed selectors
};
purify(content, css, options, function (purifiedAndMinifiedResult) {
console.log(purifiedAndMinifiedResult);
});