Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix on asset links for the symfony layout #34394

Merged
merged 1 commit into from Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/.webpack/common.js
Expand Up @@ -448,7 +448,7 @@ module.exports = {
extensions: ['woff2'],
filter: /preload/,
// eslint-disable-next-line
replaceCallback: ({indexSource, linksAsString}) => indexSource.replace('{{{preloadLinks}}}', linksAsString.replace(/href="/g, 'href="{{ admin_dir }}')),
replaceCallback: ({indexSource, linksAsString}) => indexSource.replace('{{{preloadLinks}}}', linksAsString.replace(/href="([^"]+)"/g, 'href="{{ asset(\'themes/new-theme/public/$1\') }}"')),
}),
new CssoWebpackPlugin({
forceMediaMerge: true,
Expand Down
3 changes: 3 additions & 0 deletions app/config/config.yml
Expand Up @@ -30,6 +30,9 @@ services:
framework:
assets:
version: !php/const PrestaShop\PrestaShop\Core\Version::VERSION
packages:
front_js:
base_path: '../js'

# esi: ~
secret: "%secret%"
Expand Down
Expand Up @@ -39,7 +39,7 @@
var search_product_msg = '{{ 'Search for a product'|trans({}, 'Admin.Orderscustomers.Feature') }}';
</script>

{% include "@AdminNewTheme/public/preload.html.twig" ignore missing with { 'admin_dir': '/admin-dev/themes/new-theme/public/' } %}
{% include "@AdminNewTheme/public/preload.html.twig" %}

{# Many modules register on this hook to add their assets, they use addCss and/or addJs methods to do that
(even if this is supposed to be a display hook). These methods must be executed before we loop through the
Expand Down
Expand Up @@ -23,11 +23,11 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* #}
<script src="{{ asset('themes/new-theme/public/main.bundle.js') }}"></script>
<script src="/js/admin.js"></script>
<script src="{{ asset('admin.js', 'front_js') }}"></script>
<script src="{{ asset('themes/new-theme/public/cldr.bundle.js') }}"></script>
<script src="/js/tools.js"></script>
<script src="/js/jquery/plugins/fancybox/jquery.fancybox.js"></script>
<script src="/js/jquery/plugins/chosen/jquery.chosen.js"></script>
<script src="{{ asset('tools.js', 'front_js') }}"></script>
<script src="{{ asset('jquery/plugins/fancybox/jquery.fancybox.js', 'front_js') }}"></script>
<script src="{{ asset('jquery/plugins/chosen/jquery.chosen.js', 'front_js') }}"></script>
{# This is handled as an external common dependency for both themes, but once new-theme is the only one it should be integrated directly into the main.bundle.js file#}
<script src="{{ asset('themes/new-theme/public/create_product.bundle.js') }}"></script>
{% if ps.isMultiShop %}
Expand Down
Expand Up @@ -28,8 +28,8 @@
{% else %}
<link rel="stylesheet" href="{{ asset('themes/new-theme/public/theme.css') }}" media="all">
{% endif %}
<link rel="stylesheet" href="/js/jquery/plugins/fancybox/jquery.fancybox.css" media="all">
<link rel="stylesheet" href="/js/jquery/plugins/chosen/jquery.chosen.css" media="all">
<link rel="stylesheet" href="{{ asset('jquery/plugins/fancybox/jquery.fancybox.css', 'front_js') }}" media="all">
<link rel="stylesheet" href="{{ asset('jquery/plugins/chosen/jquery.chosen.css', 'front_js') }}" media="all">
<link rel="stylesheet" href="{{ asset('themes/new-theme/public/create_product_default_theme.css') }}" media="all">
{% if lightDisplay %}
<link rel="stylesheet" href="{{ asset('themes/new-theme/public/light_theme.css') }}" media="all">
Expand Down