示例#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
}
示例#2
0
文件: options.go 项目: go-gonzo/scss
func (opt *options) SetPrecision(precision int) {
	C.sass_option_set_precision(opt.optc(), C.int(precision))
}
示例#3
0
// SassOptionSetPrecision sets the precision of floating point math
// ie. 3.2222px. This is currently bugged and does not work.
func SassOptionSetPrecision(goopts SassOptions, i int) {
	C.sass_option_set_precision(goopts, C.int(i))
}