Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack postcss loader, what's its purpose?

I am trying to find out, what the postcss-loader is good for.

On the github page

https://github.com/postcss/postcss-loader

it says:

Loader for webpack to process CSS with PostCSS

I dont't get that: So, PostCSS is a a WP-Loader to process CSS with PostCSS?

IMHO, that's a circular definition.

So what is PostCSS, is it a CSSLoader? Or, since it's called Post CSS is it a loader to run after some other CSS-loader?

like image 394
LongHike Avatar asked Mar 19 '18 10:03

LongHike


1 Answers

Actually, it isn't a direct plugin for PostCSS, it works inside Webpack. if you use Webpack in your project for module bundling, then for using PostCSS as CSS Preprocessor you must use postcss-loader and add configs of it.

For example, you can see THIS REPO, in webpack folder, there is two configuration file for development and production environment, open one of them, no different, and search the postcss-loader word in it, see a complete example of this usage.

like image 141
AmerllicA Avatar answered Sep 20 '22 07:09

AmerllicA