doverjs

DoverJS--Find unused seletor from your style-sheet to DHTML URI

npm install doverjs
12 downloads in the last week
24 downloads in the last month

DoverJS

======== Find unused css selectors from your style-sheet files to the specified HTML URI

Why DoverJS ?

DoverJS --- Simple, Convenient, Effective; Base on Nodejs; Could find unused selector from DHTML
Support Pseudo-classes, DOM Inserted
简单、易用、有效,基于NodeJS,无混合Ruby,
支持的动态脚本改变DOM的选择器匹配、伪类的匹配

Use case

  • Found unused selector from your style-sheet files to the specified HTML URI
  • (检查样式文件在指定页面的冗余style-rules)

How to use


Easy to use Csscover(使用它比Csscover简单多了)

Install [node@0.8.x](http://nodejs.org).

Install it in npm :

    npm install doverjs -g

Helping :

  Usage: doverjs [options] <file ...>

  Options:

    -h, --help                 output usage information             (使用说明)
    -V, --version              output the version number(版本信息)
    -c, --console              print process result in console      (在命令行窗口输出处理结果)
    -d, --destination <files>  destination file <file, file, ...>   (指定要检查的HTML文件,可以是远程文件)
    -j, --json <file>          using json config file               (使用JSON文件配置来批量处理)
    -o, --output <file>        Output result                        (输出结果到指定文件)
    -S, --statistics           print statistics in console(输出统计信息)
    -s, --style <files>        covering style-sheet file <file, file, ...>(指定要检查无用规则的样式文件,可以是远程文件)

Usage :

  • Usage one :
    doverjs -s xxx.css -d http://slider.jitsu.com -o out
  • Usage two :
    doverjs -j package.js
  • Console process result :
    doverjs -j package.js -c
    process result
  • Console statistics result :
    doverjs -j package.js -S
    process result

Multiple Cover use configuration files (批量覆盖的配置文件 ):

//Remove comments from this file(这个是文件配置,使用时把注释去掉,避免JSON解析出错)  e.g example/package.js
{
    //use " instead of ' in here (请用 "/双引号 代替 '/单引号)
    style : 'xxx.css', /* multiple style-sheet file: style : ["xxx.css",'aaa.css'] */
    html : [
        //Add www to the URL , avoid URL Not Found(被检查的网址,远程文件请加上"http://"否则识别为本地文件); 
        //"http://baidu.com"无法解读时,请加上www("http://www.baidu.com")
        "http://sliders.jitsu.com",
        {
            //Mutiple html url
            //可以用于url + hash的形式 prefix + suffix
            "prefix" : "http://localhost:3000/", //网址前缀
            "suffix" : ["index.html","#","path/file.js"] //网址后缀
            /**yield:
            *       http://localhost:3000/index.html,
            *       http://localhost:3000/#,
            *       http://localhost:3000/path/file.js,
            **/
        }
    ]
}

Subsequent Optimized Point

  • 大样式文件导致的报错(Compeleted @0.1.1)
  • 支持HTTPS 资源(Compeleted @0.1.1)
  • windows下,带空格文件路径导致无法运行(Compeleted @0.1.2)
  • 批量处理配置文件的语法解析优化
  • 自动删除功能
  • 复合样式文件导致的执行时间长优化
  • 命令窗口的输出内容可选项化
  • 支持Linux,Mac

Support

如果图片看不见,怎么办??囧。github的raw被墙了 <guankaishe@gmail.com>

npm loves you