Download the PHP package hostnet/css-sniffer without Composer
On this page you can find all versions of the php package hostnet/css-sniffer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package css-sniffer
IMPORTANT: Due to internal changes this repository will no longer be maintained. If you are using this, or have plans to use this, please consider an alternative like https://stylelint.io/.
The CSS sniffer is build to help improve (and maintain) a consistent code style in CSS and LESS files. It will reduce time figure out another style by enforcing rules. So no longer worrying about tabs vs. spaces, single vs. double quotes or 3 of 6 hex values for colors.
The tool is pretty straight forward, simply run it with the file you would like to inspect. So if you have a css file like so:
Simply run the tool and you will get the following output.
Some builtin sniffs are pretty opinionated. If you disagree you have two options: open an issue to change the current behavior or write your own sniff.
Installation
Using phar (recommended)
Download the phar that is attached to the latest release of the sniffer.
Using composer
$ composer require --dev hostnet/css-sniffer
- This library follows semantic versioning strictly.
Documentation
Basic usuage is as follows:
Examples:
vendor/bin/css-sniff
vendor/bin/css-sniff sniff some/file.css
vendor/bin/css-sniff sniff --format=json -p some/file.css
cat some/file.css | vendor/bin/css-sniff sniff --stdin
Sniffing for CI
The primary focus of the sniffer is to integrate with any CI tooling. For this, it is recommended to add a csssniff.xml.dist
to your project root. This will allow you to configure which files and directories to process when running the sniffer. A common example would be:
This would process the app/styles
folder relative from the project root using the Hostnet
standard. For more information about the xml structure, see the ruleset configuration documentation.
Output formatting
Multiple output formats are supported. For now there is console
(the default), checkstyle
and json
. The json
output looks as follows:
The
-p
is only a pretty format, this is optional but more readable.
STDIN
input
The sniffer can also read from the STDIN
. This can be usefull when intergrating the tool in an IDE where you might not have a file but want to pass the contents of an editor. Make sure to add the --stdin
to tell the sniffer to read the STDIN
. You can also pass a file to allows for you matching rules to work.
License
The hostnet/css-sniffer
is licensed under the MIT License, meaning you can reuse the code within proprietary software provided that all copies of the licensed software include a copy of the MIT License terms and the copyright notice.
Get in touch
- Our primary contact channel is via IRC: freenode.net#hostnet.
- Or via our email: [email protected].
All versions of css-sniffer with dependencies
symfony/console Version ^3.3||^4.0
yannickl88/css-tokenizer Version ^1.1.1