Exemplo n.º 1
0
// Init validates options in the struct and returns a Sass Options.
func (ctx *Context) Init(goopts *SassOptions) *C.struct_Sass_Options {
	opts := (*C.struct_Sass_Options)(goopts)
	if ctx.Precision == 0 {
		ctx.Precision = 5
	}
	cmt := C.bool(ctx.Comments)
	imgpath := C.CString(ctx.ImageDir)
	prec := C.int(ctx.Precision)

	defer func() {
		C.free(unsafe.Pointer(imgpath))
		// C.free(unsafe.Pointer(cc))
		// C.sass_delete_data_context(dc)
	}()
	Mixins(ctx)
	ctx.SetHeaders(opts)
	ctx.SetImporter(opts)
	ctx.SetIncludePaths(opts)
	ctx.SetFunc(opts)

	C.sass_option_set_precision(opts, prec)
	C.sass_option_set_source_comments(opts, cmt)
	return opts
}
Exemplo n.º 2
0
func (opt *options) SetSourceComments(comment bool) {
	C.sass_option_set_source_comments(opt.optc(), C._Bool(comment))
}
Exemplo n.º 3
0
// SassOptionSetSourceComments toggles the output of line comments in CSS
func SassOptionSetSourceComments(goopts SassOptions, b bool) {
	C.sass_option_set_source_comments(goopts, C.bool(b))
}