Skip to content

Commit 818928c

Browse files
committed
feature #8272 Adding documentation for 0.13.0 Encore feature changes (weaverryan)
This PR was merged into the 3.3 branch. Discussion ---------- Adding documentation for 0.13.0 Encore feature changes Various changes, all mentioned here: https://github.com/symfony/webpack-encore/releases/tag/v0.13.0 :) Commits ------- 58b5596 Adding documentation for 0.13.0 Encore feature changes
2 parents 2d83789 + 58b5596 commit 818928c

File tree

6 files changed

+75
-7
lines changed

6 files changed

+75
-7
lines changed

frontend/encore/babel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Need to extend the Babel configuration further? The easiest way is via
2323
babelConfig.presets.push('es2017');
2424
2525
// no plugins are added by default, but you can add some
26-
// babelConfig.plugins = ['styled-jsx/babel'];
26+
// babelConfig.plugins.push('styled-jsx/babel');
2727
})
2828
;
2929

frontend/encore/css-preprocessors.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,19 @@ And enable it in ``webpack.config.js``:
5959
.enableLessLoader()
6060
;
6161
62-
That's it! All files ending in ``.less`` will be pre-processed.
62+
That's it! All files ending in ``.less`` will be pre-processed. You can also pass
63+
options to ``less-loader``:
64+
65+
.. code-block:: javascript
66+
67+
// webpack.config.js
68+
// ...
69+
70+
Encore
71+
// ...
72+
.enableLessLoader(function(options) {
73+
// https://github.com/webpack-contrib/less-loader#examples
74+
// http://lesscss.org/usage/#command-line-usage-options
75+
// options.relativeUrls = false;
76+
});
77+
;

frontend/encore/dev-server.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ by the normal `webpack-dev-server`_. For example:
2424
2525
This will start a server at ``https://localhost:9000``.
2626

27+
Using dev-server inside a VM
28+
----------------------------
29+
30+
If you're using ``dev-server`` from inside a virtual machine, then you'll need
31+
to bind to all IP addresses and allow any host to access the server:
32+
33+
.. code-block:: terminal
34+
35+
$ ./node_modules/.bin/encore dev-server --host 0.0.0.0 --disable-host-check
36+
37+
You can now access the dev-server using the IP address to your virtual machine on
38+
port 8080 - e.g. http://192.168.1.1:8080.
39+
2740
Hot Module Replacement HMR
2841
--------------------------
2942

frontend/encore/postcss.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ Then, Enable the loader in Encore!
3636
;
3737
3838
That's it! The ``postcss-loader`` will now be used for all CSS, Sass, etc files.
39+
You can also pass options to the `postcss-loader`_ by passing a callback:
40+
41+
.. code-block:: diff
42+
43+
// webpack.config.js
44+
45+
Encore
46+
// ...
47+
+ .enablePostCssLoader((options) => {
48+
+ options.config = {
49+
+ path: 'app/config/postcss.config.js'
50+
+ };
51+
+ })
52+
;
3953
4054
Adding browserslist to package.json
4155
-----------------------------------
@@ -62,4 +76,5 @@ See `browserslist`_ for more details on the syntax.
6276
.. _`autoprefixing`: https://github.com/postcss/autoprefixer
6377
.. _`linting`: https://stylelint.io/
6478
.. _`browserslist`: https://github.com/ai/browserslist
65-
.. _`babel-preset-env`: https://github.com/babel/babel-preset-env
79+
.. _`babel-preset-env`: https://github.com/babel/babel-preset-env
80+
.. _`postcss-loader`: https://github.com/postcss/postcss-loader

frontend/encore/simple-example.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ To build the assets, use the ``encore`` executable:
7070
# compile assets, but also minify & optimize them
7171
$ ./node_modules/.bin/encore production
7272
73+
# shorter version of the above 3 commands
74+
$ yarn run encore dev
75+
$ yarn run encore dev -- --watch
76+
$ yarn run encore prodution
77+
7378
.. note::
7479

7580
Re-run ``encore`` each time you update your ``webpack.config.js`` file.

frontend/encore/typescript.rst

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,33 @@ also configure the `ts-loader options`_ via a callback:
3434
If React assets are enabled (``.enableReactPreset()``), any ``.tsx`` file will be
3535
processed as well by ``ts-loader``.
3636

37-
Loader usage can be checked better in its `README`_ documentation.
37+
More information about the ``ts-loader`` can be found in its `README`_.
3838

39-
"Use webpack like normal, including ``webpack --watch`` and ``webpack-dev-server``,
40-
or through another build system using the Node.js API."
39+
Faster Builds with fork-ts-checker-webpack-plugin
40+
-------------------------------------------------
4141

42-
-- Running section of ts-loader documentation
42+
By using `fork-ts-checker-webpack-plugin`_, you can run type checking in a separate
43+
process, which can speedup compile time. To enable it, install the plugin:
44+
45+
.. code-block:: terminal
46+
47+
$ yarn add --dev fork-ts-checker-webpack-plugin
48+
49+
Then enable it by calling:
50+
51+
.. code-block:: diff
52+
53+
// webpack.config.js
54+
55+
Encore
56+
// ...
57+
enableForkedTypeScriptTypesChecking()
58+
;
59+
60+
This plugin requires that you have a `tsconfig.json`_ file that is setup correctly.
4361

4462
.. _`TypeScript`: https://www.typescriptlang.org/
4563
.. _`ts-loader options`: https://github.com/TypeStrong/ts-loader#options
4664
.. _`README`: https://github.com/TypeStrong/ts-loader#typescript-loader-for-webpack
65+
.. _`fork-ts-checker-webpack-plugin`: https://www.npmjs.com/package/fork-ts-checker-webpack-plugin
66+
.. _`tsconfig.json`: https://www.npmjs.com/package/fork-ts-checker-webpack-plugin#modules-resolution

0 commit comments

Comments
 (0)