Skip to content

Encore manifest.json, assets package base_path #36844

@plashenkov

Description

@plashenkov

Symfony version:
5.0.7

Description
assets.packages.base_path is not used with json_manifest_path.

For example, this is my manifest.json:

{
  "build/admin/admin.js": "/build/admin/admin.b991d27f.js",
  "build/admin/runtime.js": "/build/admin/runtime.2dd405e4.js"
}

This is my assets.yaml:

framework:
    assets:
        packages:
            admin:
                base_path: /build/admin
                json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json'

When I call asset() function from Twig, omitting the base_path prefix, manifest.json is ignored:

<!-- Twig: -->
<script src="{{ asset('admin.js', 'admin') }}"></script>

<!-- I expect (please note the b991d27f postfix): -->
<script src="/build/admin/admin.b991d27f.js"></script>

<!-- I really get: -->
<script src="/build/admin/admin.js"></script>

If to provide full path to asset() function, it renders the correct file name (with postfix).
I.e. if I want to use manifest.json I have to specify a full path regardless of base_path provided.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy