Skip to content

Commit

Permalink
[Maintenance] Add app webpack endpoint to twig hooks (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee authored Nov 29, 2024
2 parents f779a3e + 82d4b67 commit 606db19
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 4 deletions.
1 change: 0 additions & 1 deletion assets/admin/entry.js

This file was deleted.

2 changes: 2 additions & 0 deletions assets/admin/entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// In this file you can import assets like images or stylesheets
console.log('Hello Webpack Encore! Edit me in assets/admin/entrypoint.js');
1 change: 0 additions & 1 deletion assets/shop/entry.js

This file was deleted.

2 changes: 2 additions & 0 deletions assets/shop/entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// In this file you can import assets like images or stylesheets
console.log('Hello Webpack Encore! Edit me in assets/shop/entrypoint.js');
19 changes: 19 additions & 0 deletions config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ sylius_channel:
channel:
classes:
model: App\Entity\Channel\Channel

sylius_core:
resources:
avatar_image:
Expand Down Expand Up @@ -138,6 +139,7 @@ sylius_payum:
payment_security_token:
classes:
model: App\Entity\Payment\PaymentSecurityToken

sylius_product:
resources:
product:
Expand Down Expand Up @@ -246,6 +248,7 @@ sylius_taxonomy:
translation:
classes:
model: App\Entity\Taxonomy\TaxonTranslation

sylius_user:
resources:
admin:
Expand All @@ -260,3 +263,19 @@ sylius_user:
user:
classes:
model: App\Entity\User\UserOAuth

sylius_twig_hooks:
hooks:
'sylius_admin.base#stylesheets':
app_styles:
template: 'admin/stylesheets.html.twig'
'sylius_admin.base#javascripts':
app_javascripts:
template: 'admin/javascripts.html.twig'

'sylius_shop.base#stylesheets':
app_styles:
template: 'shop/stylesheets.html.twig'
'sylius_shop.base#javascripts':
app_javascripts:
template: 'shop/javascripts.html.twig'
2 changes: 2 additions & 0 deletions templates/admin/javascripts.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

{{ encore_entry_script_tags('app-admin-entry', null, 'app.admin') }}
1 change: 1 addition & 0 deletions templates/admin/stylesheets.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_link_tags('app-admin-entry', null, 'app.admin') }}
1 change: 1 addition & 0 deletions templates/shop/javascripts.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_script_tags('app-shop-entry', null, 'app.shop') }}
1 change: 1 addition & 0 deletions templates/shop/stylesheets.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ encore_entry_link_tags('app-shop-entry', null, 'app.shop') }}
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const shopConfig = SyliusShop.getWebpackConfig(path.resolve(__dirname));
Encore
.setOutputPath('public/build/app/shop')
.setPublicPath('/build/app/shop')
.addEntry('app-shop-entry', './assets/shop/entry.js')
.addEntry('app-shop-entry', './assets/shop/entrypoint.js')
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
Expand All @@ -32,7 +32,7 @@ Encore.reset();
Encore
.setOutputPath('public/build/app/admin')
.setPublicPath('/build/app/admin')
.addEntry('app-admin-entry', './assets/admin/entry.js')
.addEntry('app-admin-entry', './assets/admin/entrypoint.js')
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
Expand Down

0 comments on commit 606db19

Please sign in to comment.