rosid-handler-postcss

1.0.0 • Public • Published

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 to false.

Returns

  • {Promise<String|Buffer>} The transformed file content.

/rosid-handler-postcss/

    Package Sidebar

    Install

    npm i rosid-handler-postcss

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    6.02 kB

    Total Files

    6

    Last publish

    Collaborators

    • omarkhatibco