Skip to content

Commit 42422c8

Browse files
Basstertobias-93
authored andcommitted
adopt usage.rst
1 parent 167ca0e commit 42422c8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Resources/doc/usage.rst

+16
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ If you are using webpack and Encore to package your assets you can use the webpa
3434
3535
Then use it simply by importing ``import Routing from 'fos-router';`` in your js or ts code
3636

37+
The plugin hooks into the webpack `build` and `watch` process and triggers the `fos:js-routing:dump` command automatically,
38+
once routes have been changed.
39+
40+
To avoid that, e.g. when building the frontend on a machine or docker image/layer, where no PHP is present, you can configure the
41+
plugin to use a static dumped `routes.json` and suppress automatic recompilation of the file, by passing some options to the plugin:
42+
43+
.. code-block:: js
44+
45+
const FosRouting = require('fos-router/webpack/FosRouting');
46+
//...
47+
Encore
48+
.addPlugin(new FosRouting(
49+
{ target: './assets/js/routes.json' }, // <- path to dumped routes.json
50+
false // <- set false to suppress automatic recompilation of the file
51+
)
52+
)
3753
3854
Alternatively you can use the dump command
3955
and export your routes to json, this command will create a json file into the ``public/js`` folder:

0 commit comments

Comments
 (0)