Running postcss in the browser #830

Closed
matsko opened this Issue Jun 23, 2016 · 2 comments

Projects

None yet

2 participants

matsko commented Jun 23, 2016

Hey guys.

Do you guys have an implementation in place for running postcss in the browser? Is there anything that prevents you guys from making it work in JavaScript on a browser without node? I did some work setting up rollup UMD bundles and it works somewhat, but it would be great if the NPM package included a bundled file that can be used directly in the browser.

Owner
ai commented Jun 23, 2016

If you want to process CSS in string in browser, just use browserify or webpack to pack npm modules of postcss and PostCSS plugins to bundle.

PostCSS don’t need node.js API to process CSS string (it loads fs module, but webpack/browserify have a nice hack for it).

@ai ai closed this Jun 23, 2016
Owner
ai commented Jun 23, 2016

But you need to make bundle by your own. There are 2 reasons:

  1. npm community should really think about npm packages sizes. Having a pack in npm package will increase package size to 3-4 times.
  2. Anyway you need bundles not only for PostCSS core itself, but also for plugins. So anyway you will use browserify/webpack to packe PostCSS core with PostCSS plugins.
@janschoenherr janschoenherr added a commit to janschoenherr/postcss that referenced this issue Feb 14, 2017
@janschoenherr janschoenherr Running postcss in the browser
To run postcss in the browser, the module _fs_ is required. With this addition we can tell webpack to ignore the _fs_ module.

This has been an issue before #830

https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module
75060af
@ai ai added a commit that referenced this issue Feb 15, 2017
@janschoenherr @ai janschoenherr + ai Running postcss in the browser (#971)
To run postcss in the browser, the module _fs_ is required. With this addition we can tell webpack to ignore the _fs_ module.

This has been an issue before #830

https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module
1eb4b05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment