@@ -144,15 +144,12 @@ functions to specify which build to use:
144
144
{{ encore_entry_script_tags('mobile', null, 'secondConfig') }}
145
145
{{ encore_entry_link_tags('mobile', null, 'secondConfig') }}
146
146
147
- Avoid missing CSS when render multiples html
148
- --------------------------------------------
147
+ Avoid Missing CSS When Rendering Multiple Templates
148
+ ---------------------------------------------------
149
149
150
- When you need to generate two templates in the same request, such as two emails, you should call the reset method on
151
- the ``EntrypointLookupInterface `` interface.
152
-
153
- To do this, inject the ``EntrypointLookupInterface `` interface
154
-
155
- .. code-block :: php
150
+ When you render two or more templates in the same request, such as two emails,
151
+ you should call the ``reset() `` method on the ``EntrypointLookupInterface `` interface.
152
+ To do this, inject the ``EntrypointLookupInterface `` interface::
156
153
157
154
public function __construct(EntrypointLookupInterface $entryPointLookup) {}
158
155
@@ -162,14 +159,13 @@ To do this, inject the ``EntrypointLookupInterface`` interface
162
159
$this->render($emailTwo);
163
160
}
164
161
165
- If you are using multiple webpack configurations, for example, one for the admin and one for emails, you will need to
166
- inject the correct ``EntrypointLookupInterface `` service. To achieve this, you should search for the service
167
- using the following command:
162
+ If you are using multiple Webpack configurations (e.g. one for the admin and one
163
+ for emails) you will need to inject the right ``EntrypointLookupInterface `` service.
164
+ Use the following command to find the right service :
168
165
169
166
.. code-block :: terminal
170
167
171
- # if you are using symfony CLI
172
- $ symfony console debug:container entrypoint_lookup
168
+ $ php bin/console console debug:container entrypoint_lookup
173
169
174
170
# You will see a result similar to this:
175
171
Select one of the following services to display its information:
@@ -179,18 +175,19 @@ using the following command:
179
175
[3] webpack_encore.entrypoint_lookup[admin]
180
176
[4] webpack_encore.entrypoint_lookup[email]
181
177
182
- The service we are interested in is ``webpack_encore.entrypoint_lookup[email] ``.
178
+ In this example, the configuration related to the ``email `` configuration is
179
+ the one called ``webpack_encore.entrypoint_lookup[email] ``.
183
180
184
- To inject this service into your class, we will use the bind method :
181
+ To inject this service into your class, use the `` bind `` option :
185
182
186
183
.. code-block :: yaml
187
184
185
+ # config/services.yaml
188
186
services :
189
187
_defaults
190
188
bind :
191
189
Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface $entryPointLookupEmail : ' @webpack_encore.entrypoint_lookup[email]'
192
190
193
-
194
191
Now you can inject your service into your class:
195
192
196
193
.. code-block :: php
0 commit comments