rosid-handler-postcss
v1.0.0
Published
Load css and transform it using postcss
Downloads
12
Maintainers
Readme
rosid-handler-postcss
Load css and transform it using postcss
Install
npm install rosid-handler-postcss
Usage
API
const handler = require('rosid-handler-postcss');
handler('main.css').then(data => {});
handler('main.css', { optimize: true }).then(data => {});
Postcss
install your Postcss plugins and add it to postcss.config.js
module.exports = {
plugins: {
precss: {}
}
};
Rosid
Add the following object to your rosidfile.json
, rosidfile.js
or routes array. rosid-handler-postcss
will transform all matching css files in your source folder using Postcss.
{
"name": "css",
"path": "[^_]*.css*",
"handler": "rosid-handler-postcss"
}
/* main.css */
.class {
color: white;
+ .class 2 {
color: red;
}
}
/* main.css (output) */
.class {
color: white;
}
.class + .class 2 {
color: red;
}
Parameters
filePath
{String}
Absolute path to file.opts
{?Object}
Options. -optimize
{?Boolean}
- Optimize output. Defaults tofalse
.
Returns
{Promise<String|Buffer>}
The transformed file content.