From d2ee9111e05cf6033f683bc30f4cedbed69f6167 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Wed, 20 Nov 2024 09:59:53 +0100 Subject: [PATCH 1/4] [Maintenance] Add app webpack endpoint to twig hooks --- assets/admin/entry.js | 1 + assets/shop/entry.js | 1 + config/packages/_sylius.yaml | 19 +++++++++++++++++++ templates/admin/javascripts.html.twig | 2 ++ templates/admin/stylesheets.html.twig | 1 + templates/shop/javascripts.html.twig | 1 + templates/shop/stylesheets.html.twig | 1 + 7 files changed, 26 insertions(+) create mode 100644 templates/admin/javascripts.html.twig create mode 100644 templates/admin/stylesheets.html.twig create mode 100644 templates/shop/javascripts.html.twig create mode 100644 templates/shop/stylesheets.html.twig diff --git a/assets/admin/entry.js b/assets/admin/entry.js index 8acf2c2aa0..746e34cfc0 100644 --- a/assets/admin/entry.js +++ b/assets/admin/entry.js @@ -1 +1,2 @@ // In this file you can import assets like images or stylesheets +console.log('Hello Webpack Encore! Edit me in assets/shop/entry.js'); diff --git a/assets/shop/entry.js b/assets/shop/entry.js index 8acf2c2aa0..746e34cfc0 100644 --- a/assets/shop/entry.js +++ b/assets/shop/entry.js @@ -1 +1,2 @@ // In this file you can import assets like images or stylesheets +console.log('Hello Webpack Encore! Edit me in assets/shop/entry.js'); diff --git a/config/packages/_sylius.yaml b/config/packages/_sylius.yaml index d188419cb8..4770040f9c 100644 --- a/config/packages/_sylius.yaml +++ b/config/packages/_sylius.yaml @@ -46,6 +46,7 @@ sylius_channel: channel: classes: model: App\Entity\Channel\Channel + sylius_core: resources: avatar_image: @@ -138,6 +139,7 @@ sylius_payum: payment_security_token: classes: model: App\Entity\Payment\PaymentSecurityToken + sylius_product: resources: product: @@ -246,6 +248,7 @@ sylius_taxonomy: translation: classes: model: App\Entity\Taxonomy\TaxonTranslation + sylius_user: resources: admin: @@ -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' diff --git a/templates/admin/javascripts.html.twig b/templates/admin/javascripts.html.twig new file mode 100644 index 0000000000..0c21379ab3 --- /dev/null +++ b/templates/admin/javascripts.html.twig @@ -0,0 +1,2 @@ + +{{ encore_entry_script_tags('app-admin-entry', null, 'app.admin') }} diff --git a/templates/admin/stylesheets.html.twig b/templates/admin/stylesheets.html.twig new file mode 100644 index 0000000000..dc98d75101 --- /dev/null +++ b/templates/admin/stylesheets.html.twig @@ -0,0 +1 @@ +{{ encore_entry_link_tags('app-admin-entry', null, 'app.admin') }} diff --git a/templates/shop/javascripts.html.twig b/templates/shop/javascripts.html.twig new file mode 100644 index 0000000000..a659c2c1d0 --- /dev/null +++ b/templates/shop/javascripts.html.twig @@ -0,0 +1 @@ +{{ encore_entry_script_tags('app-shop-entry', null, 'app.shop') }} diff --git a/templates/shop/stylesheets.html.twig b/templates/shop/stylesheets.html.twig new file mode 100644 index 0000000000..b439fca170 --- /dev/null +++ b/templates/shop/stylesheets.html.twig @@ -0,0 +1 @@ +{{ encore_entry_link_tags('app-shop-entry', null, 'app.shop') }} From 33a977fafdae774f45f767646e04d0b1babba374 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Tue, 26 Nov 2024 09:03:27 +0100 Subject: [PATCH 2/4] [Maintenance] Minor fix --- assets/admin/entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/admin/entry.js b/assets/admin/entry.js index 746e34cfc0..43b5fad3db 100644 --- a/assets/admin/entry.js +++ b/assets/admin/entry.js @@ -1,2 +1,2 @@ // In this file you can import assets like images or stylesheets -console.log('Hello Webpack Encore! Edit me in assets/shop/entry.js'); +console.log('Hello Webpack Encore! Edit me in assets/admin/entry.js'); From d4c1295f1e61a4cb031efc0d1535c6b4a4683dc1 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Wed, 27 Nov 2024 08:20:14 +0100 Subject: [PATCH 3/4] [Maintenance] Rename entry.js to entrypoint.js --- assets/admin/{entry.js => entrypoint.js} | 0 assets/shop/{entry.js => entrypoint.js} | 0 webpack.config.js | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename assets/admin/{entry.js => entrypoint.js} (100%) rename assets/shop/{entry.js => entrypoint.js} (100%) diff --git a/assets/admin/entry.js b/assets/admin/entrypoint.js similarity index 100% rename from assets/admin/entry.js rename to assets/admin/entrypoint.js diff --git a/assets/shop/entry.js b/assets/shop/entrypoint.js similarity index 100% rename from assets/shop/entry.js rename to assets/shop/entrypoint.js diff --git a/webpack.config.js b/webpack.config.js index 1e7f94c799..5bbadcb09c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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()) @@ -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()) From 82d4b67a7aa4a23e6df380553c6acfad0509a4e8 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Wed, 27 Nov 2024 13:17:12 +0100 Subject: [PATCH 4/4] [Maintenance] Rename entry.js to entrypoint.js --- assets/admin/entrypoint.js | 2 +- assets/shop/entrypoint.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/admin/entrypoint.js b/assets/admin/entrypoint.js index 43b5fad3db..81eac18531 100644 --- a/assets/admin/entrypoint.js +++ b/assets/admin/entrypoint.js @@ -1,2 +1,2 @@ // In this file you can import assets like images or stylesheets -console.log('Hello Webpack Encore! Edit me in assets/admin/entry.js'); +console.log('Hello Webpack Encore! Edit me in assets/admin/entrypoint.js'); diff --git a/assets/shop/entrypoint.js b/assets/shop/entrypoint.js index 746e34cfc0..6379be9ceb 100644 --- a/assets/shop/entrypoint.js +++ b/assets/shop/entrypoint.js @@ -1,2 +1,2 @@ // In this file you can import assets like images or stylesheets -console.log('Hello Webpack Encore! Edit me in assets/shop/entry.js'); +console.log('Hello Webpack Encore! Edit me in assets/shop/entrypoint.js');