8000 render_assets incorrectly sorts JavaScript and CSS files by name · Issue #121 · jpsca/jinjax · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
render_assets incorrectly sorts JavaScript and CSS files by name #121
Open
@ikus060

Description

@ikus060

Description:

The render_assets function in Jinjax is currently sorting JavaScript and CSS files alphabetically by their names before rendering them. This behavior introduces issues when the loading order of assets is critical — for example, when a script depends on another being loaded first (e.g., jQuery before a plugin), or when CSS rules are intended to override earlier ones.

Expected behavior:
Assets should be rendered in the order they are declared. This ensures that dependencies are respected and styles/scripts behave as intended.

Actual behavior:
Assets are being automatically sorted by filename, breaking intended load order.

Suggested fix:
Remove automatic sorting in render_assets and preserve the user-defined order.
To let the user in control, it could be an argument when calling catalog.render_assets(sorting=False).

Environment:

Jinjax version: 0.57
Python version: 3.12

Here a screen capture of the difference in rendering...

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0