postcssify
Browserify plugin for postcss
Install
npm install postcssify --save-dev
Usage
entry.js
$ browserify entry.js -o build.js -t postcssify --css bundle.css
CSS merge order
When the files are merged, postcssify preserves the order one would normally expect from require
. If the required javascript would execute first in node, that CSS appears first in the bundle. For example, consider the following files, all living in the same directory.
entry.js
component.js
bundle.css
/* css from main.css *//* css from component.css *//* css from finalTouches.css *//* Base64-encoded source map */
Node.js
If you want to run the same code in node, you'll need to tell it to ignore .css
files. One way of doing this is using the enhance-require package (hacky but makes it easy).
const enhanceRequire = // overwrites require // required styles will be ignoredenhanceRequire // restores require