File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments