# README
libsass
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 withgo 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
# Functions
BasePath sets the internal path provided to handlers requiring a base path for http calls.
BuildDir only used for spriting, how terrible!.
CacheBust append timestamps to static assets to prevent caching.
Comments toggles whether comments should be included in the output.
CompFromCtx retrieves a compiler from a passed context.
Error takes a Go error and returns a libsass Error.
FontDir specifies where to find fonts.
Handler accepts a HandlerFunc and returns SassCallback for sending to libsass.
HTTPPath prefixes all sprites and generated images with this uri.
ImgBuildDir specifies the destination directory for images.
ImgDir specifies where to locate images for spriting.
ImportsOption specifies configuration for import resolution.
IncludePaths adds additional directories to search for Sass files.
LineComments removes the line by line playby of the Sass compiler.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewHeaders instantiates a Headers for prefixing Sass to input See: https://github.com/sass/libsass/wiki/API-Sass-Importer.
No description provided by the author
No description provided by the author
OutputStyle controls the presentation of the CSS available option: nested, expanded, compact, compressed.
Path specifies a file to read instead of using the provided io.Reader.
Payload gives access to sprite and image information for handlers to perform spriting functions.
Precision specifies the number of points beyond the decimal place is preserved during math calculations.
RegisterHandler sets the passed signature and callback to the handlers array.
RegisterHeader fifo.
RegisterSassFunc assigns the passed Func to the specified signature sign.
SassHandler contains callback context for running code within a libsass handler.
SourceMap behaves differently depending on compiler used.
ToScss converts Sass to Scss with libsass sass2scss.h.
Decode converts Sass Value to Go compatible data types.
Version reports libsass version information.
Warn takes a string and causes a warning in libsass.
No description provided by the author
# Constants
Constants/enums for the output style.
Constants/enums for the output style.
Constants/enums for the output style.
Constants/enums for the output style.
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TestCallback implements libs.SassCallback.
# Structs
Cookie is used for passing context information to libsass.
No description provided by the author
No description provided by the author
No description provided by the author
Import contains Rel and Abs path and a string of the contents representing an import.
Imports is a map with key of "path/to/file".
SassError represents an error object returned from Sass.
No description provided by the author
# Type aliases
HandlerFunc describes the method signature for registering a Go function to be called by libsass.
SassFunc describes func for handling Sass Values.
Syntax lists that available syntaxes for the compiler.