Skip to content

Commit 606db19

Browse files
authored
[Maintenance] Add app webpack endpoint to twig hooks (#1075)
2 parents f779a3e + 82d4b67 commit 606db19

10 files changed

+30
-4
lines changed

assets/admin/entry.js

-1
This file was deleted.

assets/admin/entrypoint.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// In this file you can import assets like images or stylesheets
2+
console.log('Hello Webpack Encore! Edit me in assets/admin/entrypoint.js');

assets/shop/entry.js

-1
This file was deleted.

assets/shop/entrypoint.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// In this file you can import assets like images or stylesheets
2+
console.log('Hello Webpack Encore! Edit me in assets/shop/entrypoint.js');

config/packages/_sylius.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ sylius_channel:
4646
channel:
4747
classes:
4848
model: App\Entity\Channel\Channel
49+
4950
sylius_core:
5051
resources:
5152
avatar_image:
@@ -138,6 +139,7 @@ sylius_payum:
138139
payment_security_token:
139140
classes:
140141
model: App\Entity\Payment\PaymentSecurityToken
142+
141143
sylius_product:
142144
resources:
143145
product:
@@ -246,6 +248,7 @@ sylius_taxonomy:
246248
translation:
247249
classes:
248250
model: App\Entity\Taxonomy\TaxonTranslation
251+
249252
sylius_user:
250253
resources:
251254
admin:
@@ -260,3 +263,19 @@ sylius_user:
260263
user:
261264
classes:
262265
model: App\Entity\User\UserOAuth
266+
267+
sylius_twig_hooks:
268+
hooks:
269+
'sylius_admin.base#stylesheets':
270+
app_styles:
271+
template: 'admin/stylesheets.html.twig'
272+
'sylius_admin.base#javascripts':
273+
app_javascripts:
274+
template: 'admin/javascripts.html.twig'
275+
276+
'sylius_shop.base#stylesheets':
277+
app_styles:
278+
template: 'shop/stylesheets.html.twig'
279+
'sylius_shop.base#javascripts':
280+
app_javascripts:
281+
template: 'shop/javascripts.html.twig'

templates/admin/javascripts.html.twig

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
{{ encore_entry_script_tags('app-admin-entry', null, 'app.admin') }}

templates/admin/stylesheets.html.twig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ encore_entry_link_tags('app-admin-entry', null, 'app.admin') }}

templates/shop/javascripts.html.twig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ encore_entry_script_tags('app-shop-entry', null, 'app.shop') }}

templates/shop/stylesheets.html.twig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ encore_entry_link_tags('app-shop-entry', null, 'app.shop') }}

webpack.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const shopConfig = SyliusShop.getWebpackConfig(path.resolve(__dirname));
1414
Encore
1515
.setOutputPath('public/build/app/shop')
1616
.setPublicPath('/build/app/shop')
17-
.addEntry('app-shop-entry', './assets/shop/entry.js')
17+
.addEntry('app-shop-entry', './assets/shop/entrypoint.js')
1818
.disableSingleRuntimeChunk()
1919
.cleanupOutputBeforeBuild()
2020
.enableSourceMaps(!Encore.isProduction())
@@ -32,7 +32,7 @@ Encore.reset();
3232
Encore
3333
.setOutputPath('public/build/app/admin')
3434
.setPublicPath('/build/app/admin')
35-
.addEntry('app-admin-entry', './assets/admin/entry.js')
35+
.addEntry('app-admin-entry', './assets/admin/entrypoint.js')
3636
.disableSingleRuntimeChunk()
3737
.cleanupOutputBeforeBuild()
3838
.enableSourceMaps(!Encore.isProduction())

0 commit comments

Comments
 (0)