Dart-sass-embedded fails with indented source syntax

dart-sass binary builds my sass files compile just fine, as does lib sass, however using Hugo and dart-sass-embedded I get the following error:

Error: Error building site: TOCSS-DART: failed to transform "sass/main.sass" (text/x-sass): "assets/sass/partials/_typography.sass:0:18": expected "{".

The problem seems to be that imported files get interpreted as being SCSS syntax rather than SASS (also known as INDENTED in the dart-sass-embedded source code).


Reproducable as follows:

Hugo stylesheet file:

{{ $options := dict
	"transpiler"  "dartsass"
	"outputStyle" "compressed"
}}

<link rel="stylesheet" href="{{ (resources.Get "sass/main.sass" | resources.ToCSS $options).RelPermalink }}?v={{ $.Site.Params.revision }}">

sass/main.sass:

@use "partials/typography"

main
	display: grid

sass/partials/_ typography.sass:

html
	font-family: 'IM Fell English', serif

This happens on both Hugo latest version and Hugo git master.

dart-sass-embedded —version output:

{
  "protocolVersion": "1.2.0",
  "compilerVersion": "1.58.3",
  "implementationVersion": "1.58.3",
  "implementationName": "Dart Sass",
  "id": 0
}

I can reproduce this when pulling in an indented Sass file with either @use or @import. This is not a new problem. We added the darsass transpiler option in v0.80.0. With that version I get an unexpected EOF error, but with v0.81.0 and later it throws:

context: " font-family: ‘IM Fell English’, serif\n": expected “{”.

Please create a new issue.
https://github.com/gohugoio/hugo/issues/

This is most likely a bug in godartsass, I opened an issue: Syntax of imported files isn't provided. · Issue #14 · bep/godartsass · GitHub

This was resolved in v0.114.0.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.