Skip to content

Commit

Permalink
[DesignV2] use webpack builds and asset paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dpfaffenbauer committed Nov 14, 2024
1 parent 7acf93d commit 19fbc1e
Show file tree
Hide file tree
Showing 61 changed files with 375 additions and 71,545 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function load(array $configs, ContainerBuilder $container): void
$container->setParameter('coreshop.frontend.category.default_sort_name', $configs['category']['default_sort_name']);
$container->setParameter('coreshop.frontend.category.default_sort_direction', $configs['category']['default_sort_direction']);

$container->setParameter('coreshop.frontend_dir', dirname(__DIR__));

$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
},
"dependencies": {
"core-js": "^3.39.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('path');
const Encore = require('@symfony/webpack-encore');

if (!Encore.isRuntimeEnvironmentConfigured()) {
Expand All @@ -7,7 +8,7 @@ if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore
.setOutputPath('../public/build/')
.setPublicPath('/bundles/coreshopfrontend/build/')
.setManifestKeyPrefix('bundles/coreshopfrontend/build/')
.setManifestKeyPrefix('bundles/coreshopfrontend/')
.cleanupOutputBeforeBuild()

/*
Expand All @@ -18,9 +19,6 @@ Encore
*/
.addEntry('app', './js/app.ts')

// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()

// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.disableSingleRuntimeChunk()
Expand All @@ -32,7 +30,6 @@ Encore
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
Expand Down Expand Up @@ -75,15 +72,23 @@ Encore
.copyFiles([
{
from: "./node_modules/bootstrap-icons/font/fonts",
to: "../build/fonts/[path][name].[ext]",
to: "fonts/[path][name].[ext]",
context: path.resolve(__dirname, "node_modules", "bootstrap-icons", "font", "fonts")
},
{
from: "./node_modules/flag-icons/flags/4x3",
to: "../build/flag-icons/flags//4x3/[path][name].[ext]",
to: "flag-icons/flags/4x3/[path][name].[ext]",
context: path.resolve(__dirname, "node_modules", "flag-icons", "flags", "4x3")
},
{
from: "./fonts",
to: "../build/fonts/[path][name].[ext]",
to: "fonts/[path][name].[ext]",
context: path.resolve(__dirname, "..", "assets", "fonts")
},
{
from: "./images",
to: "images/[path][name].[ext]",
context: path.resolve(__dirname, "..", "assets", "images")
},
])
.addAliases({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ twig:
form_themes:
- '@CoreShopFrontend/Form/fields.html.twig'

# TODO SET CORRECT THE PATH #
webpack_encore:
output_path: '%kernel.project_dir%/src/CoreShop/Bundle/FrontendBundle/Resources/public/build'
script_attributes:
defer: true
builds:
coreshop_frontend: '%coreshop.frontend_dir%/Resources/public/build'

framework:
assets:
packages:
coreshop_frontend:
json_manifest_path: '%coreshop.frontend_dir%/Resources/public/build/manifest.json'
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ services:
tags:
- { name: twig.extension }

CoreShop\Bundle\FrontendBundle\Twig\TranslationExtension:
arguments:
- '@Symfony\Contracts\Translation\TranslatorInterface'
tags:
- { name: twig.extension }

CoreShop\Bundle\FrontendBundle\Controller\Extend\CartWidgetController:
arguments:
$shopperContext: '@CoreShop\Component\Core\Context\ShopperContextInterface'
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 19fbc1e

Please sign in to comment.