csslint
csslint copied to clipboard
Count-properties rule
@stubbornella #333
This is a new rule for counting properties and pair-values in the CSS. It export and object.
usage :
var result = CSSLint.verify(".foo { float: left; }", { "count-properties": 1});
console.log(result.stats['count-properties'].properties.float.count;)
Output : 1
Did you try building it with Grunt?
Overall, the pull request looks good. Can you please write up some documentation for the new rule? https://github.com/stubbornella/csslint/wiki/Rules
@stubbornella Now the vendor-prefix are now manage, the regexp for cleaning is generic, and take car of some vendor prefix that doesn't begin with "-".
This list of vendor prefix is managed.
mso- Microsoft Office
-ms- Microsoft
prince- YesLogic
-<vendor prefix>- : all others vendor prefix (-moz-, -o-, -atsc-, -webkit-, etc..., it's generic)
@stubbornella I have prepared the documentation on my computer and commited in but not pushed. Because I think it's not usefull to document something that doesn't exists in the code. I prefer to wait this PR is merge and push my doc. Otherwise I can also put my doc code in a comment in this PR to see if it is okay
@arnogues - this PR won't automatically merge, can you update it?
@stubbornella you can manually rebase/merge the PR by following the intructions in the merge box.
@arnogues I'm not sure what makes the most sense for the vendor prefixing.
- Count them as the same as the unprefixed (current approach)
- Ignore them
- Count them separately
- Add them as a separate property.
result.stats['count-properties']['box-shadow].webkit.count;
I'd be tempted to ignore vendor prefixes in this rule, just because they aren't really duplication a developer can do anything about...
@arnogues - can you please put your doc code in this thread?
@arnogues: can you rebase your branch?