Go wrapper for libsass, the only Sass 3.5 compiler for Go
Clone or download
bep and drewwells Add libs.SassOptionSetInputPath (#66)
Which is needed for source map generation from a non-file context.
3
Latest commit 615eaa4 Jun 25, 2018
Permalink
Failed to load latest commit information.
blah bare bones Nov 21, 2015
examples added an example for how to use options with the compiler. (#49) May 6, 2018
external/types move payload generator to libsass Jan 1, 2016
libs Add libs.SassOptionSetInputPath (#66) Jun 24, 2018
libsass-build Update to libsass 3.5.4 (#60) May 11, 2018
libsass-src @ 1e52b74 correctly tag submodule Jun 16, 2018
test start new API Oct 20, 2015
.gitignore dont ignore include Jul 21, 2015
.gitmodules access submodule via https Apr 21, 2015
LICENSE copyright owner May 14, 2018
Makefile Update to libsass 3.5.4 (#60) May 11, 2018
README.md libsass update instructions Feb 17, 2018
appveyor.yml use new appveyor windows stack (#63) Jun 16, 2018
circle.yml switch to go1.7.1 Sep 20, 2016
compiler.go add Sass syntax option to the compiler fixes #48 (#50) May 10, 2017
compiler_test.go add Sass syntax option to the compiler fixes #48 (#50) May 10, 2017
context.go include paths must be passed as delimited list May 29, 2017
context_test.go Remove unused init() in context_test.go (#65) Jun 22, 2018
doc.go rename package to libsass Aug 21, 2015
encoding.go rename package to libsass Aug 21, 2015
encoding_test.go rename package to libsass Aug 21, 2015
error.go make context private Jan 18, 2016
error_test.go Update to libsass 3.5.4 (#60) May 11, 2018
export.go rename package to libsass Aug 21, 2015
export_test.go addition of Imports and Funcs constructs Sep 24, 2015
file_test.go enable relative sourcemap pathing within libSass Nov 25, 2016
func.go add some sassfunc documentation, unicode test case to keep track of Jun 16, 2018
func_test.go make Compile() private May 15, 2016
header.go changes for go pointer restrictions in go16 #29 Dec 20, 2015
header_test.go make Compile() private May 15, 2016
importer.go Add an imports resolver func (#64) Jun 16, 2018
importer_test.go Update to libsass 3.5.4 (#60) May 11, 2018
mixins.go injecting mixins should only happen once Sep 24, 2015
options.go add Sass syntax option to the compiler fixes #48 (#50) May 10, 2017
options_test.go make Compile() private May 15, 2016
toscss.go rename package to libsass Aug 21, 2015
toscss_test.go rename package to libsass Aug 21, 2015
unicode_test.go add some sassfunc documentation, unicode test case to keep track of Jun 16, 2018
version.go rename package to libsass Aug 21, 2015
version_test.go rename package to libsass Aug 21, 2015

README.md

libsass

Circle CI Build status

The only Sass compliant Go library! go-libsass is a wrapper to the sass/libsass project.

To build, setup Go

go build

To test

go test

Basic example more examples found in examples

buf := bytes.NewBufferString("div { p { color: red; } }")
if err != nil {
	log.Fatal(err)
}
comp, err := libsass.New(os.Stdout, buf)
if err != nil {
	log.Fatal(err)
}

if err := comp.Run(); err != nil {
	log.Fatal(err)
}

Output

div p {
  color: red; }

Updating libsass

cd libsass-src; git fetch; git checkout vX.X.X
git commit -m "updated libsass to vX.X.X"
make update-libsass
# iterate on includes and code changes until tests pass

FAQ

  • Compiling go-libsass is very slow, what can be done?

    Go-libsass compiles C/C++ libsass on every build. You can install the package and speed up building go install github.com/wellington/go-libsass. Alternatively, it's possible to link against system libsass and forego C compiling with go build -tags dev.

  • How do I cross compile?

    Since this package uses C bindings, you will need gcc for the target platform. For windows see, https://github.com/wellington/go-libsass/issues/37