Skip to content

Encore manifest.json, assets package base_path #36844

Closed
@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