Not sure why the following is throwing an error:
{{ with resources.Get "scss/bradbice.scss" }}
{{ $opts := dict "transpiler" "dartsass" "targetPath" "css/bradbice.css" }}
{{ with . | toCSS $opts }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{ end }}
{{ end }}
And Iβm getting
ERROR TOCSS-DART: failed to transform "/scss/bradbice.scss" (text/x-scss): "<stream>:1:1": Can't find stylesheet to import.
Total in 858 ms
Error: error building site: TOCSS-DART: failed to transform "/scss/bradbice.scss" (text/x-scss): "<stream>:1:1": Can't find stylesheet to import.
Folder structure is
/assets/scss/bradbice.scss
And that file has a bunch of @use
statements (relevant because this problem didnβt occur until I started switching to using @use
)
@use "reset";
@use "tokens";
@use "mixins";
@use "fonts";
My hugo env
returns this:
hugo v0.139.3+extended+withdeploy darwin/arm64 BuildDate=2024-11-29T15:36:56Z VendorInfo=brew
GOOS="darwin"
GOARCH="arm64"
GOVERSION="go1.23.3"
github.com/sass/libsass="3.6.6"
github.com/webmproject/libwebp="v1.3.2"
github.com/sass/dart-sass/protocol="3.1.0"
github.com/sass/dart-sass/compiler="1.81.0"
github.com/sass/dart-sass/implementation="1.81.0"
Not sure if this has to do with Hugo modules which I had previously played with but am not using (I deleted my go.mod
file).
deining
November 30, 2024, 4:49pm
2
The @use
rule loads mixins , functions , and variables from other Sass stylesheets.
This error message is pretty clear: the stylesheets given as argument to @use
are missing. Create (and fill) these files, any the error will go away:
$ touch assets/scss/_reset.scss
$ touch assets/scss/_tokens.scss
$ touch assets/scss/_mixins.scss
$ touch assets/scss/_fonts.scss
Does this solve your issue?
1 Like
Path should be relative to the project directory, not absolute.
touch assets/scss/_reset.scss
touch assets/scss/_tokens.scss
touch assets/scss/_mixins.scss
touch assets/scss/_fonts.scss
Those files all currently exist in assets/scss
, thatβs why Iβm confused why there is an error.
Your code with the files in the locations you describe works fine for me. Maybe do tree assets
and paste the result here.
assets
βββ code-examples
β βββ auto-size
β β βββ auto-size.html
β β βββ auto-size.scss
β βββ test
β βββ test.html
β βββ test.scss
βββ css
β βββ syntax.css
βββ data
β βββ games.json
β βββ movies.json
β βββ tv.json
βββ scss
βββ _base.scss
βββ _blog-ratings.scss
βββ _blog.scss
βββ _chroma.scss
βββ _content.scss
βββ _dialog-polyfill.scss
βββ _fonts.scss
βββ _home-blog.scss
βββ _home-work.scss
βββ _home.scss
βββ _layout.scss
βββ _library.scss
βββ _mixins.scss
βββ _print.scss
βββ _ratings-list.scss
βββ _ratings-single.scss
βββ _ratings-top.scss
βββ _reset.scss
βββ _shortcodes.scss
βββ _text-list.scss
βββ _tokens.scss
βββ _twitter-archive.scss
βββ _work.scss
βββ bradbice.scss
βββ holidays.scss
βββ patterns
βββ article__content
β βββ _article__content.scss
βββ article__footer
β βββ _article__footer.scss
βββ article__header
β βββ _article__header.scss
β βββ article__header.html
βββ article__meta
β βββ _article__meta.html
β βββ _article__meta.scss
βββ article__stub
β βββ _article__stub.scss
β βββ article__stub--blog.html
β βββ article__stub--work.html
βββ article__tags
β βββ _article__tags.scss
β βββ article__tags.html
βββ aside-section
β βββ _aside-section.html
β βββ _aside-section.scss
βββ badge
β βββ _badge.scss
βββ blockquote
β βββ _blockquote.html
β βββ _blockquote.scss
βββ breadcrumbs
β βββ _breadcrumbs.scss
βββ button
β βββ _button.html
β βββ _button.scss
βββ dialog
β βββ _dialog.scss
βββ field
β βββ _field.scss
βββ field-group
β βββ _field-group.scss
βββ figure
β βββ _figure.scss
β βββ figure.html
βββ figure__caption
β βββ _figure__caption.scss
β βββ figure__caption.html
βββ form
β βββ _form.scss
βββ global-footer
β βββ _global-footer.scss
β βββ footer.html
βββ global-header
β βββ _global-header.scss
β βββ global-header--blog.html
β βββ global-header.html
βββ global-menu
β βββ _global-menu.scss
β βββ global-menu.html
βββ headings
β βββ _headings.scss
β βββ headings.html
βββ input
β βββ _input.scss
βββ intro
β βββ _intro.scss
β βββ intro.html
βββ label
β βββ _label.scss
βββ lists
β βββ _lists.html
β βββ _lists.scss
βββ micro__stub
β βββ _micro__stub.scss
β βββ article__stub--blog.html
β βββ article__stub--work.html
βββ page-container
β βββ _page-container.scss
β βββ page-container.html
βββ pagination
β βββ _pagination.scss
β βββ pagination.html
βββ picture
β βββ _picture.scss
βββ plain-text
β βββ _plain-text.scss
β βββ plain-text.html
βββ section
β βββ _section.scss
β βββ section--full.html
β βββ section.html
βββ switch
β βββ _switch.scss
βββ tags-list
βββ _tags-list.scss
Your example shows only four. How do you know that itβs one of those four?
1 Like
Turns out I had a @forward "scss/bradbice";
in _tokens.scss
which was causing the error.
Thanks for helping me iron out my Sass bugs.
system
Closed
December 2, 2024, 7:45pm
9
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.