├── .gitattributes ├── .gitignore ├── README.md ├── example └── sample.js ├── index.js ├── lib ├── compiler.js ├── redundance.js └── style.css └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | 217 | ############# 218 | ## NodeJS 219 | ############# 220 | node_modules/ 221 | coverage.html 222 | example/debug.txt 223 | example/har_to_pagespeed.exe 224 | example/tmp.har -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | tidycss 2 | ============== 3 | 4 | > 一个快速分析CSS冗余的工具。 5 | 6 | 动机 7 | ---- 8 | 9 | 经常看到有童鞋问,有没有什么工具能快速分析出站点的CSS冗余,于是就有了这个项目。本质上,这个工具是为了解决我们 [腾讯课堂](http://ke.qq.com) 在多人开发与快速迭代下的CSS冗余问题,为代码Review提供可行的工具。 10 | 11 | 技术实现 12 | -------- 13 | 14 | [@TJ Holowaychuk](https://github.com/visionmedia) 大神为其抽象CSS预处理库 [Rework](https://github.com/reworkcss/rework) 编写了两个CSS处理的基础库: 15 | * [css-parse](https://github.com/reworkcss/css-parse) 将CSS转成便于遍历分析的JSON对象。 16 | * [css-stringify](https://github.com/reworkcss/css-stringify) 将css-parse生成的JSON对象编译成CSS。 17 | 18 | 由此降低了我们对CSS分析以及生成的难度。[cheerio](https://github.com/cheeriojs/cheerio) 为我们提供了服务器端高速jQuery实现,简化了对DOM的选择器查询。而PhantomJS则提供了获取特定状态下页面所有DOM节点的方法。 19 | 20 | 简单的说,我们获取所有CSS的选择器,然后在DOM中进行逐一选取,对没有取到任何节点的选择器进行标记,最后在生成相应报表。 21 | 22 | 使用 23 | ---- 24 | 25 | * 安装 phantomjs 到环境变量 26 | 27 | 安装 PhantomJS,并使得运行下面命令有反应: 28 | 29 | > $ phantomjs 30 | 31 | * 安装: 32 | 33 | > $ npm install tidycss 34 | 35 | * 写一个例子: 36 | 37 | ```javascript 38 | var tidy = require('tidycss'); 39 | 40 | tidy( 41 | // 你要检测冗余的url 42 | 'http://ke.qq.com', 43 | // 可选参数 44 | { 45 | // 不对common.xxxx.css检测冗余,因为这个是站点公共文件 46 | ignore: /common\..*\.css/, 47 | // 忽略的选择器列表, 即这里的选择器是被review后可冗余项, 48 | // 比如有通过javascript动态生成的DOM树 49 | unchecks: ['.mod-nav__course-all span:hover'] 50 | } 51 | ); 52 | ``` 53 | 54 | * 运行则可见到相关报表,用于代码reveiw。 55 | 56 | ## License 57 | (The MIT License) 58 | 59 | Copyright (c) 2013 Daniel Yang 60 | 61 | Copyright (c) 2014 QQEDU TEAM 62 | 63 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 64 | 65 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 66 | 67 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 68 | -------------------------------------------------------------------------------- /example/sample.js: -------------------------------------------------------------------------------- 1 | var tidy = require('../'); 2 | 3 | tidy('http://ke.qq.com', { 4 | ignore: /common\..*?\.css/, 5 | unchecks: ['.mod-nav__course-all span:hover'] 6 | }); -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | exports = module.exports = require('./lib/redundance'); 2 | 3 | exports.version = '0.0.1'; -------------------------------------------------------------------------------- /lib/compiler.js: -------------------------------------------------------------------------------- 1 | // modify from css-stringify(https://github.com/reworkcss/css-stringify) 2 | 3 | /** 4 | * Expose `Compiler`. 5 | */ 6 | 7 | module.exports = Compiler; 8 | 9 | /** 10 | * Initialize a compiler. 11 | * 12 | * @param {Type} name 13 | * @return {Type} 14 | * @api public 15 | */ 16 | 17 | function Compiler(opts) { 18 | this.options = opts || {}; 19 | } 20 | 21 | /** 22 | * Emit `str` 23 | */ 24 | 25 | Compiler.prototype.emit = function(str) { 26 | return str; 27 | }; 28 | 29 | /** 30 | * Visit `node`. 31 | */ 32 | 33 | Compiler.prototype.visit = function(node){ 34 | return this[node.type](node); 35 | }; 36 | 37 | /** 38 | * Map visit over array of `nodes`, optionally using a `delim` 39 | */ 40 | 41 | Compiler.prototype.mapVisit = function(nodes, delim){ 42 | var buf = ''; 43 | delim = delim || ''; 44 | 45 | for (var i = 0, length = nodes.length; i < length; i++) { 46 | buf += this.visit(nodes[i]); 47 | if (delim && i < length - 1) buf += this.emit(delim); 48 | } 49 | 50 | return buf; 51 | }; 52 | 53 | /** 54 | * Compile `node`. 55 | */ 56 | 57 | Compiler.prototype.compile = function(node){ 58 | return this.stylesheet(node); 59 | }; 60 | 61 | /** 62 | * Visit stylesheet node. 63 | */ 64 | 65 | Compiler.prototype.stylesheet = function(node){ 66 | return this.mapVisit(node.stylesheet.rules, '\n\n'); 67 | }; 68 | 69 | /** 70 | * Visit comment node. 71 | */ 72 | 73 | Compiler.prototype.comment = function(node){ 74 | return this.emit(this.indent() + '/*' + node.comment + '*/'); 75 | }; 76 | 77 | /** 78 | * Visit media node. 79 | */ 80 | 81 | Compiler.prototype.media = function(node){ 82 | return this.emit('@media ' + node.media + ' ') 83 | + this.emit( 84 | ' {\n' 85 | + this.indent(1)) 86 | + this.mapVisit(node.rules, '\n\n') 87 | + this.emit( 88 | this.indent(-1) 89 | + '\n}'); 90 | }; 91 | 92 | /** 93 | * Visit charset node. 94 | */ 95 | 96 | Compiler.prototype.charset = function(node){ 97 | return this.emit('@charset ' + node.charset + ';'); 98 | }; 99 | 100 | /** 101 | * Visit namespace node. 102 | */ 103 | 104 | Compiler.prototype.namespace = function(node){ 105 | return this.emit('@namespace ' + node.namespace + ';', node.position); 106 | }; 107 | 108 | /** 109 | * Visit missing node. 110 | */ 111 | 112 | Compiler.prototype.missing = function (node) { 113 | var indent = this.indent(); 114 | var decls = node.declarations; 115 | if (!decls.length) return ''; 116 | 117 | return this.emit('') 118 | + this.emit(node.selectors.map(function(s){ return indent + '' + s + '' }).join(',\n')) 119 | + this.emit(' {\n') 120 | + this.emit(this.indent(1)) 121 | + this.mapVisit(decls, '\n', true) 122 | + this.emit(this.indent(-1)) 123 | + this.emit('\n' + this.indent() + '}') 124 | + this.emit(''); 125 | } 126 | 127 | /** 128 | * Visit rule node. 129 | */ 130 | 131 | Compiler.prototype.rule = function(node){ 132 | var indent = this.indent(); 133 | var decls = node.declarations; 134 | if (!decls.length) return ''; 135 | 136 | return this.emit(node.selectors.map(function(s){ return indent + '' + s + '' }).join(',\n')) 137 | + this.emit(' {\n') 138 | + this.emit(this.indent(1)) 139 | + this.mapVisit(decls, '\n') 140 | + this.emit(this.indent(-1)) 141 | + this.emit('\n' + this.indent() + '}'); 142 | }; 143 | 144 | /** 145 | * Visit declaration node. 146 | */ 147 | 148 | Compiler.prototype.declaration = function(node){ 149 | return this.emit(this.indent()) 150 | + this.emit('' + node.property + ': ' + node.value + '') 151 | + this.emit(';'); 152 | }; 153 | 154 | /** 155 | * Increase, decrease or return current indentation. 156 | */ 157 | 158 | Compiler.prototype.indent = function(level) { 159 | this.level = this.level || 1; 160 | 161 | if (null != level) { 162 | this.level += level; 163 | return ''; 164 | } 165 | 166 | return Array(this.level).join(' '); 167 | }; 168 | 169 | /** 170 | * Visit keyframes node. 171 | */ 172 | 173 | Compiler.prototype.keyframes = function(node){ 174 | return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) 175 | + this.emit( 176 | ' {\n' 177 | + this.indent(1)) 178 | + this.mapVisit(node.keyframes, '\n') 179 | + this.emit( 180 | this.indent(-1) 181 | + '}'); 182 | } 183 | 184 | /** 185 | * Visit keyframe node. 186 | */ 187 | 188 | Compiler.prototype.keyframe = function(node){ 189 | var decls = node.declarations; 190 | 191 | return this.emit(this.indent()) 192 | + this.emit(node.values.join(', '), node.position) 193 | + this.emit( 194 | ' {\n' 195 | + this.indent(1)) 196 | + this.mapVisit(decls, '\n') 197 | + this.emit( 198 | this.indent(-1) 199 | + '\n' 200 | + this.indent() + '}\n'); 201 | }; 202 | 203 | /** 204 | * Visit page node. 205 | */ 206 | 207 | Compiler.prototype.page = function(node){ 208 | var sel = node.selectors.length 209 | ? node.selectors.join(', ') + ' ' 210 | : ''; 211 | 212 | return this.emit('@page ' + sel, node.position) 213 | + this.emit('{\n') 214 | + this.emit(this.indent(1)) 215 | + this.mapVisit(node.declarations, '\n') 216 | + this.emit(this.indent(-1)) 217 | + this.emit('\n}'); 218 | }; 219 | 220 | /** 221 | * Visit font-face node. 222 | */ 223 | 224 | Compiler.prototype['font-face'] = function(node){ 225 | return this.emit('@font-face ', node.position) 226 | + this.emit('{\n') 227 | + this.emit(this.indent(1)) 228 | + this.mapVisit(node.declarations, '\n') 229 | + this.emit(this.indent(-1)) 230 | + this.emit('\n}'); 231 | }; 232 | 233 | /** 234 | * Visit host node. 235 | */ 236 | 237 | Compiler.prototype.host = function(node){ 238 | return this.emit('@host', node.position) 239 | + this.emit( 240 | ' {\n' 241 | + this.indent(1)) 242 | + this.mapVisit(node.rules, '\n\n') 243 | + this.emit( 244 | this.indent(-1) 245 | + '\n}'); 246 | }; 247 | 248 | /** 249 | * Visit custom-media node. 250 | */ 251 | 252 | Compiler.prototype['custom-media'] = function(node){ 253 | return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position); 254 | }; -------------------------------------------------------------------------------- /lib/redundance.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * css-redundance 3 | * Copyright (c) 2013 Daniel Yang 4 | * Copyright (c) 2014 QQEDU TEAM 5 | * MIT Licensed 6 | */ 7 | module.exports = (function () { 8 | "use strict"; 9 | var valid = require('url-valid') 10 | , dom = require('url-dom') 11 | , cssParse = require('css-parse') 12 | , compiler = new (require('./compiler'))() 13 | , noop = function () {} 14 | , pseudoClasses = /\:hover|\:active/; 15 | 16 | var fs = require('fs'); 17 | 18 | function _$(selector, $) { 19 | try { 20 | var tmp = $(selector); 21 | } catch (e) { 22 | if (selector.match(pseudoClasses)) { 23 | return _$(selector.replace(pseudoClasses, '')); 24 | } else { 25 | return {}; 26 | } 27 | } 28 | return tmp; 29 | } 30 | 31 | function Redundance(url, options) { 32 | var self = this; 33 | options = options || {}; 34 | this.url = url; 35 | this.$ = undefined; 36 | this.ignore = options.ignore; 37 | this.dist = options.dist || './'; 38 | this.load(url); 39 | this.unchecks = {}; 40 | (options.unchecks || []).forEach(function (selector) { 41 | self.unchecks[selector] = true; 42 | }) 43 | } 44 | Redundance.prototype = { 45 | constructor: Redundance, 46 | load: function (url) { 47 | var self = this; 48 | valid(url).on('check', function (err, valid) { 49 | if (!err) { 50 | dom(url).success(function ($) { 51 | self.$ = $; 52 | $('link[rel="stylesheet"]').each(function () { 53 | self.checkCSS($(this).attr('href')); 54 | }); 55 | }); 56 | } 57 | }); 58 | // prevent load again 59 | this.load = noop; 60 | }, 61 | checkCSS: function (href) { 62 | if (href.indexOf('//') === 0) href = 'http:' + href 63 | // ignore 64 | if (this.ignore && this.ignore.test(href)) return; 65 | var self = this 66 | , selectorList = [] 67 | , ruleMap = {}; 68 | this._loadCSS(href, function (css) { 69 | // Traversal all rules 70 | css.stylesheet.rules.forEach(function (item) { 71 | if (item.type === 'rule') { 72 | var hasCache = false; 73 | item.selectors.forEach(function (selector) { 74 | !ruleMap[selector] && 75 | (ruleMap[selector] = []) && 76 | selectorList.push(selector); 77 | 78 | !hasCache && 79 | (hasCache = true) && 80 | ruleMap[selector].push(item); 81 | }); 82 | } 83 | }); 84 | 85 | selectorList.forEach(function (selector) { 86 | var $ = _$(selector, self.$); 87 | if ($.length || self.unchecks[selector]) { 88 | ruleMap[selector] = null; 89 | delete ruleMap[selector]; 90 | } else { 91 | ruleMap[selector].forEach(function (rule) { 92 | rule.type = 'missing'; 93 | }); 94 | } 95 | }); 96 | 97 | self._render(css, href, selectorList, ruleMap); 98 | }); 99 | }, 100 | _loadCSS: function (href, callback) { 101 | var self = this 102 | , buffers = [] 103 | , v = valid(href) 104 | .on('data', function (err, buffer) { 105 | if (err) { 106 | // log a error 107 | console.error(href + ' not found!'); 108 | return v.destroy(); 109 | } 110 | buffers.push(buffer); 111 | }) 112 | .on('end', function () { 113 | if (buffers.length) { 114 | callback(cssParse(Buffer.concat(buffers).toString())); 115 | } 116 | v.destroy(); 117 | }); 118 | }, 119 | _render: function (css, href, selectorList, ruleMap) { 120 | var result = [ 121 | 'CSS冗余Reviewer', 122 | '', 125 | '', 126 | '

' + href + '

', 127 | '
',
128 |         compiler.compile(css),
129 |         '
' 130 | ]; 131 | fs.writeFileSync(this.dist + href.substring(href.lastIndexOf('/'), href.length) + '.html', result.join('')); 132 | } 133 | } 134 | 135 | return function (url, options) { 136 | return (new Redundance(url, options)); 137 | } 138 | 139 | })(); -------------------------------------------------------------------------------- /lib/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | padding: 0.5em; 10 | background: #23241f; 11 | } 12 | 13 | .hljs, 14 | .hljs-tag, 15 | .css .hljs-rules, 16 | .css .hljs-value, 17 | .css .hljs-function 18 | .hljs-preprocessor, 19 | .hljs-pragma { 20 | color: #f8f8f2; 21 | } 22 | 23 | .hljs-strongemphasis, 24 | .hljs-strong, 25 | .hljs-emphasis { 26 | color: #a8a8a2; 27 | } 28 | 29 | .hljs-bullet, 30 | .hljs-blockquote, 31 | .hljs-horizontal_rule, 32 | .hljs-number, 33 | .hljs-regexp, 34 | .alias .hljs-keyword, 35 | .hljs-literal, 36 | .hljs-hexcolor { 37 | color: #ae81ff; 38 | } 39 | 40 | .hljs-tag .hljs-value, 41 | .hljs-code, 42 | .hljs-title, 43 | .css .hljs-class, 44 | .hljs-class .hljs-title:last-child { 45 | color: #a6e22e; 46 | } 47 | 48 | .hljs-link_url { 49 | font-size: 80%; 50 | } 51 | 52 | .hljs-strong, 53 | .hljs-strongemphasis { 54 | font-weight: bold; 55 | } 56 | 57 | .hljs-emphasis, 58 | .hljs-strongemphasis, 59 | .hljs-class .hljs-title:last-child { 60 | font-style: italic; 61 | } 62 | 63 | .hljs-keyword, 64 | .hljs-function, 65 | .hljs-change, 66 | .hljs-winutils, 67 | .hljs-flow, 68 | .lisp .hljs-title, 69 | .clojure .hljs-built_in, 70 | .nginx .hljs-title, 71 | .tex .hljs-special, 72 | .hljs-header, 73 | .hljs-attribute, 74 | .hljs-symbol, 75 | .hljs-symbol .hljs-string, 76 | .hljs-tag .hljs-title, 77 | .hljs-value, 78 | .alias .hljs-keyword:first-child, 79 | .css .hljs-tag, 80 | .css .unit, 81 | .css .hljs-important { 82 | color: #f92672; 83 | } 84 | 85 | .hljs-function .hljs-keyword, 86 | .hljs-class .hljs-keyword:first-child, 87 | .hljs-constant, 88 | .css .hljs-attribute { 89 | color: #66d9ef; 90 | } 91 | 92 | .hljs-variable, 93 | .hljs-params, 94 | .hljs-class .hljs-title { 95 | color: #f8f8f2; 96 | } 97 | 98 | .hljs-string, 99 | .css .hljs-id, 100 | .hljs-subst, 101 | .haskell .hljs-type, 102 | .ruby .hljs-class .hljs-parent, 103 | .hljs-built_in, 104 | .django .hljs-template_tag, 105 | .django .hljs-variable, 106 | .smalltalk .hljs-class, 107 | .django .hljs-filter .hljs-argument, 108 | .smalltalk .hljs-localvars, 109 | .smalltalk .hljs-array, 110 | .hljs-attr_selector, 111 | .hljs-pseudo, 112 | .hljs-addition, 113 | .hljs-stream, 114 | .hljs-envvar, 115 | .apache .hljs-tag, 116 | .apache .hljs-cbracket, 117 | .tex .hljs-command, 118 | .hljs-prompt, 119 | .hljs-link_label, 120 | .hljs-link_url { 121 | color: #e6db74; 122 | } 123 | 124 | .hljs-comment, 125 | .hljs-javadoc, 126 | .java .hljs-annotation, 127 | .python .hljs-decorator, 128 | .hljs-template_comment, 129 | .hljs-pi, 130 | .hljs-doctype, 131 | .hljs-deletion, 132 | .hljs-shebang, 133 | .apache .hljs-sqbracket, 134 | .tex .hljs-formula { 135 | color: #75715e; 136 | } 137 | 138 | .coffeescript .javascript, 139 | .javascript .xml, 140 | .tex .hljs-formula, 141 | .xml .javascript, 142 | .xml .vbscript, 143 | .xml .css, 144 | .xml .hljs-cdata, 145 | .xml .php, 146 | .php .xml { 147 | opacity: 0.5; 148 | } 149 | 150 | code.missing { 151 | background: #1231ab; 152 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tidycss", 3 | "version": "0.2.2", 4 | "description": "A library to find redundant CSS", 5 | "keywords": [ 6 | "CSS", 7 | "redundant", 8 | "redundance", 9 | "library" 10 | ], 11 | "repository": "git://github.com/QQEDU/tidycss.git", 12 | "author": "Daniel Yang ", 13 | "main": "index", 14 | "engines": { 15 | "node": ">= 0.8.0" 16 | }, 17 | "dependencies": { 18 | "url-valid": "*", 19 | "url-dom": "*", 20 | "css-parse": "1.7.0" 21 | }, 22 | "license": "MIT" 23 | } --------------------------------------------------------------------------------