hammypants / golibsass

Easy to use Go bindings for LibSass.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Go Report Card LibSass Version codecov GoDoc

The primary motivation for this project is to provide SCSS support to Hugo. I welcome PRs with bug fixes. I will also consider adding functionality, but please raise an issue discussing it first.

If you need more functionality than this project can provide you may want to have a look at go-libsass.

Usage

A basic example (error handling omitted):

transpiler, _ := libsass.New(libsass.Options{OutputStyle: libsass.CompressedStyle})
	
result, _ := transpiler.Execute(`
$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}
`)

fmt.Println(result.CSS)
// Output: body{font:100% Helvetica,sans-serif;color:#333}

See the GoDoc for more options.

Update LibSass version

This project embeds the LibSASS source code as a Git subtree. To update:

  1. Pull in the relevant LibSASS version, e.g. ./pull-libsass.sh 3.6.3
  2. Regenerate wrappers with go generate ./gen
  3. Update the LibSass version badge above.

Local development

Compiling C++ code isn' particulary fast; if you install libsass on your PC you can link against that, useful during development.

On a Mac you may do something like:

brew install --HEAD libsass
go test ./libsass -tags dev

About

Easy to use Go bindings for LibSass.

License:MIT License


Languages

Language:C++ 92.8%Language:Shell 2.0%Language:Go 1.7%Language:C 1.7%Language:Makefile 0.8%Language:M4 0.7%Language:Perl 0.2%