geelen/plugin-postcss

Example

Closed this issue · 3 comments

Any chance you could link to an example of a full project that has this working? I am trying to following your README but nothing is happening. Normal css imports are working, but none of the postcss stuff like autoprefixer or cssnext is working. I have created a 'css.js' file in the root of my app with the following:

import postcss from 'plugin-postcss';
import autoprefixer from 'autoprefixer';
import cssnext from 'cssnext';

let plugins = [ autoprefixer, cssnext ];
let { fetch, hotReload, bundle } = postcss(plugins);

export { fetch, hotReload, bundle };

Do I need to import this in my entry module?

Sorry, this project is undergoing a pretty massive upheaval to support the new CSS Modules spec. But what you've got there is definitely right, not sure why it's not working at a glance.

But this proves that the existing API is not very good, I think. If you can copy-paste an example and it doesn't work, and I can't see why, that's a bad sign :)

The new plugin will be much simpler, something like (a css.js file):

import cssLoader from 'css-loader';
import cssnext from 'cssnext';

cssLoader.plugins = [cssnext];

export default cssLoader;

Thanks for the response. I won't waste you time if the architecture is going to change. I read your initial issue concerning how difficult it was to do this properly with JSPM, and saw a similar sentiment with the experimental LESS plug-in. It will be awesome if a solid plugin model can be sorted out for JSPM. With the awesome jspm-server eliminating the need to use Browser-Sync, Sass compilation is the only Gulp task I have left after switching to JSPM from Browserify, and I would gladly switch to cssnext for what my needs are.

Hey @chrismbeckett, the new loader is out at https://github.com/geelen/jspm-loader-css. Check it out and let me know if you have any issues :)