godartsass icon indicating copy to clipboard operation
godartsass copied to clipboard

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

Open RyanPrentiss opened this issue 2 years ago • 0 comments

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" ...)

RyanPrentiss avatar Oct 05 '23 21:10 RyanPrentiss