8000 Merge branch '6.3' into 6.4 · symfony/symfony-docs@db49e10 · GitHub
[go: up one dir, main page]

Skip to content

Commit db49e10

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: [Encore] Webpack Dev Server: live reload & HMR
2 parents 206ed0c + d1de154 commit db49e10

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

frontend/encore/dev-server.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,34 @@ your page. HMR works automatically with CSS (as long as you're using the
128128
``dev-server`` and Encore 1.0 or higher) but only works with some JavaScript
129129
(like :doc:`Vue.js </frontend/encore/vuejs>`).
130130

131+
Live Reloading when changing PHP / Twig Files
132+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133+
134+
To utilize the HMR superpower along with live reload for your PHP code and
135+
templates, set the following options:
136+
137+
138+
.. code-block:: javascript
139+
140+
// webpack.config.js
141+
// ...
142+
143+
Encore
144+
// ...
145+
146+
.configureDevServerOptions(options => {
147+
options.liveReload = true;
148+
options.static = {
149+
watch: false
150+
};
151+
options.watchFiles = {
152+
paths: ['src/**/*.php', 'templates/**/*'],
153+
};
154+
})
155+
156+
The ``static.watch`` option is required to disable the default reloading of
157+
files from the static directory, as those files are already handled by HMR.
158+
131159
.. versionadded:: 1.0.0
132160

133161
Before Encore 1.0, you needed to pass a ``--hot`` flag at the command line

0 commit comments

Comments
 (0)
0