0.1.0 • Published 7 years ago
matricss v0.1.0
matricss
The pluggable analysis utility for CSS powered by PostCSS.
Install
You can install matricss via npm or yarn:
$ npm install --save-dev matricss
$ yarn add --dev matricss
And some plugins to analyze your CSS.
$ npm install --save-dev matricss-rules
$ npm install --save-dev matricss-decls
Usage
CLI
$ matricss --help
Usage
matricss [<file|directory|glob> ...]
Options
--config, -c Specify config
--help, -h Output help
--stdin, -s Use stdin
--use, -u Specify matricss plugin
--version, -v Output version
Examples
$ matricss --use pluginName foo.css bar.css
$ matricss --config ./.matricssrc foo.css
$ cat foo.css | matricss --stdin --use pluginName
If you want to add matricss to your project local, you can modify package.json
like this:
{
"name": "project-name",
"scripts": {
"test": "matricss"
},
"devDependencies": {
"matricss": "^0.1.0"
}
}
Node.js
Standalone:
const matricss = require('matricss');
matricss.process({
css: '.foo { display: block; }',
plugins: [...]
}).then(metrics => {
console.log(metrics);
});
As PostCSS plugin:
const postcss = require('postcss');
const matricss = require('matricss');
postcss([
matricss({
plugins: [...]
})
]).process('.foo { display: block; }').then(result => {
console.log(result.metrics);
});
Configuration
You can configure matricss via matricss
property of your package.json
, .matricssrc
, matricss.config.js
(powered by cosmiconfig
) according to following JSON format.
In plugins
property, you can omit plugin prefix. If you want to use matricss-rules
, prefer rules
to matricss-rules
to specify.
{
"plugins": [
"plugin-name",
"path/to/plugin-name"
]
}