Ejemplo n.º 1
0
// ImageURL handles calls to resolve a local image from the
// built css file path.
func ImageURL(ctx *libsass.Context, csv libsass.UnionSassValue) libsass.UnionSassValue {
	var path []string
	err := libsass.Unmarshal(csv, &path)
	// This should create and throw a sass error
	if err != nil {
		return libsass.Error(err)
	}
	url := filepath.Join(ctx.RelativeImage(), path[0])
	res, err := libsass.Marshal(fmt.Sprintf("url('%s')", url))
	if err != nil {
		return libsass.Error(err)
	}
	return res
}