@@ -4,11 +4,26 @@ PostCSS and autoprefixing (postcss-loader)
44`PostCSS `_ is a CSS post-processing tool that can transform your CSS in a lot
55of cool ways, like `autoprefixing `_, `linting `_ and more!
66
7- First, download ``postcss-loader `` and any plugins you want, like ``autoprefixer ``:
7+ First enable it in ``webpack.config.js ``:
8+
9+ .. code-block :: diff
10+
11+ // webpack.config.js
12+
13+ Encore
14+ // ...
15+ + .enablePostCssLoader()
16+ ;
17+
18+ Then restart Encore. When you do, it will give you a command you can run to
19+ install any missing dependencies. After running that command and restarting
20+ Encore, you're done!
21+
22+ Next, download any plugins you want, like ``autoprefixer ``:
823
924.. code-block :: terminal
1025
11- $ yarn add postcss-loader autoprefixer --dev
26+ $ yarn add autoprefixer --dev
1227
1328 Next, create a ``postcss.config.js `` file at the root of your project:
1429
@@ -24,19 +39,6 @@ Next, create a ``postcss.config.js`` file at the root of your project:
2439 }
2540 }
2641
27- Then, enable the loader in Encore!
28-
29- .. code-block :: diff
30-
31- // webpack.config.js
32-
33- Encore
34- // ...
35- + .enablePostCssLoader()
36- ;
37-
38- Because you just modified ``webpack.config.js ``, stop and restart Encore.
39-
4042 That's it! The ``postcss-loader `` will now be used for all CSS, Sass, etc files.
4143You can also pass options to the `postcss-loader `_ by passing a callback:
4244
0 commit comments