@@ -4,11 +4,26 @@ PostCSS and autoprefixing (postcss-loader)
4
4
`PostCSS `_ is a CSS post-processing tool that can transform your CSS in a lot
5
5
of cool ways, like `autoprefixing `_, `linting `_ and more!
6
6
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 ``:
8
23
9
24
.. code-block :: terminal
10
25
11
- $ yarn add postcss-loader autoprefixer --dev
26
+ $ yarn add autoprefixer --dev
12
27
13
28
Next, create a ``postcss.config.js `` file at the root of your project:
14
29
@@ -24,19 +39,6 @@ Next, create a ``postcss.config.js`` file at the root of your project:
24
39
}
25
40
}
26
41
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
-
40
42
That's it! The ``postcss-loader `` will now be used for all CSS, Sass, etc files.
41
43
You can also pass options to the `postcss-loader `_ by passing a callback:
42
44
0 commit comments