From 14c28e151d586c8cba8324969dbe22e6dbbce864 Mon Sep 17 00:00:00 2001 From: Hylke <1644844+zbrag@users.noreply.github.com> Date: Sun, 17 Mar 2019 10:46:19 +0100 Subject: [PATCH] Update advanced-config.rst It took me some time to find https://github.com/symfony/webpack-encore/issues/477 , so I guess it would be better to add it to the official documentation. --- frontend/encore/advanced-config.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/frontend/encore/advanced-config.rst b/frontend/encore/advanced-config.rst index 72c68609c92..36818a7059d 100644 --- a/frontend/encore/advanced-config.rst +++ b/frontend/encore/advanced-config.rst @@ -100,6 +100,27 @@ prefer to build configs separately, pass the ``--config-name`` option: $ yarn encore dev --config-name firstConfig +Now you can use the configurations by using + +.. code-block:: terminal + + webpack_encore: + output_path: '%kernel.public_dir%/public/default_build' + builds: + foo: '%kernel.public_dir%/public/foo_build' + bar: '%kernel.public_dir%/public/bar_build' + +And in your templatefiles you can reference the builds with: + +.. code-block:: terminal + + {# Using the entrypoints.json file located in ./public/foo_build #} + {{ encore_entry_script_tags('foo_entry', null, 'foo') }} + {{ encore_entry_link_tags('foo_entry', null, 'foo') }} + {# Using the entrypoints.json file located in ./public/bar_build #} + {{ encore_entry_script_tags('bar_entry', null, 'bar') }} + {{ encore_entry_link_tags('bar_entry', null, 'bar') }} + Generating a Webpack Configuration Object without using the Command-Line Interface ----------------------------------------------------------------------------------