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

dartsass: Unable to resolve directory paths to directory index files #12849

Closed jmooring closed 2 months ago

jmooring commented 2 months ago

Details: https://discourse.gohugo.io/t/51528/15

Applicable to Sass imported as a Hugo module, Hugo is unable to resolve directory paths to directory index files.

For example, this:

@use foo/bar

does not resolve to any of these:

This affects both @use and @forward rules. See:

https://github.com/gohugoio/hugo/blob/28f621d4a73ca7e97e23b33cbf3780ddab188d24/resources/resource_transformers/tocss/dartsass/transform.go#L137

Based on experimentation, we should resolve to a file instead of a directory when both exist with same base name:

assets/
└── sass/
    ├── foo/
    │   └── _index.scss
    ├── foo.scss
    └── main.scss    <-- @use "foo";

In the above, we should resolve to foo.scss instead of foo/_index.scss.

bep commented 2 months ago

What is a "index file" and where is the spec?

jmooring commented 2 months ago

https://sass-lang.com/documentation/at-rules/use/#index-files

jmooring commented 2 months ago

To reiterate, the problem is limited to Sass imported as a Hugo module. If the files exist in the OS file system, directory imports work as expected.

cooperaj commented 2 months ago

Thanks for putting my inane forum ramblings together into a bug @jmooring. I really appreciate it. 😄

Was tearing my hair out with this one.

github-actions[bot] commented 1 month ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.