Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sassTranspiler.Execute returns "Unexpected EOF" for indented sass. #21

Closed
RyanPrentiss opened this issue Oct 5, 2023 · 1 comment
Closed

Comments

@RyanPrentiss
Copy link

RyanPrentiss commented Oct 5, 2023

The following returns Unexpected EOF no matter the indented sass input. Is this a bug, or am I going about this incorrectly?

import (
	"log"
	"os"

	"github.com/bep/godartsass/v2"
)

func Compile() {
	sassTranspiler, err := godartsass.Start(godartsass.Options{})
	if err != nil {
		log.Fatal(err)
	}
	defer sassTranspiler.Close()

	result, err := sassTranspiler.Execute(godartsass.Args{
		Source:          "./_index.sass",
		OutputStyle:     godartsass.OutputStyleCompressed,
		SourceSyntax:    godartsass.SourceSyntaxSASS,
		EnableSourceMap: true,
	})
	if err != nil {
		log.Fatal(err)
	}

	os.WriteFile("../assets/style.css", []byte(result.CSS), 0644)
	os.WriteFile("../assets/style.css.map", []byte(result.SourceMap), 0644)
}

Copilot told me to scrap it and use exec.Command("sass" ...)

@bep
Copy link
Owner

bep commented May 29, 2024

Copilot told me to scrap it and use exec.Command("sass" ...)

Got to love AI.

As to the issue, your usage looks correct, but I have not seen any similar reports in Hugo.

I suspect you need to upgrade your Sass version. The protocol used in this library is relatively new, see
https://gohugo.io/functions/resources/tocss/#installation-overview

@bep bep closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants