@@ -100,26 +100,29 @@ prefer to build configs separately, pass the ``--config-name`` option:
100
100
101
101
$ yarn encore dev --config-name firstConfig
102
102
103
- Now you can use the configurations by using
103
+ Next, define the output directories of each build:
104
104
105
- .. code-block :: terminal
105
+ .. code-block :: yaml
106
106
107
+ # config/packages/webpack_encore.yaml
107
108
webpack_encore :
108
- output_path: '%kernel.public_dir%/public/default_build'
109
- builds:
110
- foo: '%kernel.public_dir%/public/foo_build'
111
- bar: '%kernel.public_dir%/public/bar_build'
112
-
113
- And in your templatefiles you can reference the builds with:
109
+ output_path : ' %kernel.public_dir%/web/default_build'
110
+ builds :
111
+ firstConfig : ' %kernel.public_dir%/web/first_build'
112
+ secondConfig : ' %kernel.public_dir%/web/second_build'
114
113
115
- .. code-block :: terminal
114
+ Finally, use the third optional parameter of the ``encore_entry_*_tags() ``
115
+ functions to specify which build to use:
116
+
117
+ .. code-block :: twig
118
+
119
+ {# Using the entrypoints.json file located in ./web/first_build #}
120
+ {{ encore_entry_script_tags('app', null, 'firstConfig') }}
121
+ {{ encore_entry_link_tags('global', null, 'firstConfig') }}
116
122
117
- {# Using the entrypoints.json file located in ./public/foo_build #}
118
- {{ encore_entry_script_tags('foo_entry', null, 'foo') }}
119
- {{ encore_entry_link_tags('foo_entry', null, 'foo') }}
120
- {# Using the entrypoints.json file located in ./public/bar_build #}
121
- {{ encore_entry_script_tags('bar_entry', null, 'bar') }}
122
- {{ encore_entry_link_tags('bar_entry', null, 'bar') }}
123
+ {# Using the entrypoints.json file located in ./web/second_build #}
124
+ {{ encore_entry_script_tags('mobile', null, 'secondConfig') }}
125
+ {{ encore_entry_link_tags('mobile', null, 'secondConfig') }}
123
126
124
127
Generating a Webpack Configuration Object without using the Command-Line Interface
125
128
----------------------------------------------------------------------------------
0 commit comments