gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.94k stars 7.54k forks source link

Allow JS (and possibly also in the future CSS, SCSS) imports to resolve relative to the content bundle #12876

Open bep opened 1 month ago

bep commented 1 month ago

Working on #12641 it's now (or when that is merged) already possible to include page bundled JS resources in a JS bundle built by ESBuild.

It's also possible to import CSS files, which will be bundled in a separate CSS file.

As of writing this, these CSS imports will be resolved in /assets only. But it would obviously be useful if we also could resolve relative to the content bundle itself:

content
├── _index.md
└── components
    ├── _index.md
    └── dialog
        ├── dialog.css
        ├── dialog.jsx
        └── index.md

Note to self: To get the dependency tracking working when running in server/watch mode, we cannot resolve on the file system; we need to resolve in Page.Resources.