#sass #source-map #importer #header #alt #function #libsass

sass-alt

A more powerful alternative to sass-rs that provides SASS functions, SASS importers and source map manipulation

8 releases

Uses old Rust 2015

0.2.7 Dec 18, 2017
0.2.6 Dec 15, 2017

#1700 in Rust patterns


Used in hyper-static-server

MIT license

110KB
2.5K SLoC

sass-alt

sass-alt is a rust crate that provides altenative bindings to sass-rs for using libsass (specifically, the sass-sys bindings).

It exposes functionality to register SASS functions, SASS importers, SASS headers and to manipulate source maps.

Licensing

The license for this project is MIT.


lib.rs:

This crate provides a simple API that allows one to compile SASS and use Rust functions as SASS functions, importers and headers. It is used by the Cordial crate to allow Lua code to be embedded inside SASS. To get started:-

extern crate sass_alt;

use sass_alt::FunctionList;
use sass_alt::InputSyntax;
use sass_alt::SassOptions;

fn main()
{
	let sass_functions = vec![];
	let function_list = Rc::new(SassFunctionList(sass_functions));

	let importer_functions = vec![];
	let importer_list = Rc::new(SassImportersList(importer_functions));

	let header_functions = vec![];
	let header_list = Rc::new(SassImportersList(header_functions));

	let css = SassOptions::minified_css(InputSyntax::SCSS, &["/path/to/sass/includes"], &function_list, &importer_list, &header_list).compile_data(".hello { color: red }").unwrap();
}

Dependencies

~1MB
~27K SLoC