微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

uncss

编程之家收集整理的这个编程导航主要介绍了uncss编程之家,现在分享给大家,也给大家做个参考。

uncss 介绍

Uncss 是一个用于移除脚本中无用 css 的工具。它可以审查多个文件,也可以审查由 JavaScript 注入的 css。 

uncss安装

npm install -g uncss

在node中使用:

var uncss = require('uncss');

var files = ['my','array','of','html','files','or','http://urls.com'],

options = {

ignore : ['#added_at_runtime',/test-[0-9]+/],

media : ['(min-width: 700px) handheld and (orientation: landscape)'],

csspath : '../public/css/',

raw : 'h1 { color: green }',

stylesheets : ['lib/bootstrap/dist/css/bootstrap.css','src/public/css/main.css'],

ignoreSheets : [/fonts.googleapis/],

timeout : 1000,

htmlroot : 'public',

report : false,

banner : false,

uncssrc : '.uncssrc',

userAgent : 'Mozilla/5.0 (iPhone; cpu iPhone OS 10_3 like Mac OS X)',

inject : function(window){ window.document.querySelector('html').classList.add('no-csscalc','csscalc'); }

};

uncss(files,options,function (error,output) {

console.log(output);

});

/* Look Ma,no options! */

uncss(files,output) {

console.log(output);

});

/* Specifying raw html */

var rawhtml = '...';

uncss(rawhtml,output) {

console.log(output);

});

 

网站地址:https://uncss-online.com/

GitHub:https://github.com/uncss/uncss

网站描述:移除 Web 应用中不需要的 CSS 样式

uncss

官方网站:https://uncss-online.com/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。