Not being a programmer, I wasn't aware of the existence of linters, tools that check the syntax and quality of programming code (which CSS is certainly now). As it turns out, there are linters for CSS.
I wish I'd known about this when I was working on my last WebWorks project. I spent a lot of time trying to figure out why my CSS wasn't doing what I thought it should be doing.We call these mistake-preventing programs "linters." JavaScript has several good ones. ESLint, in particular, has been working wonders, showing us all just how helpful a good linter can be. But in the realm of CSS we have not been so fortunate. We've had very limited options: the Ruby-based, preprocessor-specific scss-lint and the older CSS Lint.But that was before the advent of PostCSS. Among other things, PostCSS provides the means to build more interoperable CSS tools. It can parse any CSS*-like* syntax into an Abstract Syntax Tree (AST) for plugins to analyze and manipulate. And with custom parsers, PostCSS can handle even non-standard, technically "invalid" patterns (like //-comments).The conditions are ripe for a mighty new stylesheet linter — powered by PostCSS and inspired by the best features of scss-lint and ESLint.I've been working with a few collaborators on this project, and I'm writing now to introduce you to the tool we've developed: stylelint.
And more powerful CSS tools are being developed.
We’re constantly looking for ways to improve the way we write CSS: OOCSS, BEM, SMACSS, ITCSS, utility-first and more. But where other development communities seem to have progressed from just linters to tools like SonarQube and PHP Mess Detector, the CSS community still lacks tooling for deeper inspection than shallow lint rules. For that reason I have created Project Wallace, a suite of tools for inspecting and enforcing CSS quality.
At the core, Project Wallace is a group of tools that includes a command line interface, linter, analysis, and reporting.That probably would have been overkill for what I was doing but it would have been interesting to play around with nonetheless. And the web developer who helped me out with one of the projects I worked on certainly would have liked it.
No comments:
Post a Comment