1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
package main
import (
"fmt"
"github.com/wellington/go-libsass/libs"
)
func main() {
//run("blah.scss")
run("error.scss")
}
func run(path string) {
//cheads := libs.SassMakeImporterList(1)
gofc := libs.SassMakeFileContext(path)
// goopts := libs.SassFileContextGetOptions(gofc)
// libs.SassOptionSetCHeaders(goopts, cheads)
// libs.SassOptionSetOutputStyle(goopts, 2)
// Set options
// libs.SassFileContextSetOptions(gofc, goopts)
goctx := libs.SassFileContextGetContext(gofc)
gocomp := libs.SassMakeFileCompiler(gofc)
defer libs.SassDeleteCompiler(gocomp)
libs.SassCompilerParse(gocomp)
libs.SassCompilerExecute(gocomp)
gostr := libs.SassContextGetOutputString(goctx)
fmt.Println(gostr)
errStatus := libs.SassContextGetErrorStatus(goctx)
if errStatus > 0 {
fmt.Println("error:", libs.SassContextGetErrorJSON(goctx))
}
}
|