Converts multiple types of inputs to a single Sass input string for sass.

as_sass(input)

Arguments

input

Either a

  • raw Sass string

  • named list containing variable names and values

  • Sass-like file name.

Value

a single character value to be supplied to sass

Details

Note that the LibSass compiler expects .sass files to use the Sass Indented Syntax.

See also

Examples

# Example of regular Sass input as_sass("body { color: \"blue\"; }")
#> /* Sass */ #> body { color: "blue"; }
# There is support for adding variables as_sass( list( list(color = "blue"), "body { color: $color; }" ) )
#> /* Sass */ #> $color: blue; #> body { color: $color; }
# \donttest{ # Add a file name someFile <- tempfile("variables") # Overwrite color to red write("$color: \"red\";", someFile) input <- as_sass( list( list(color = "blue"), sass_file(someFile), "body { color: $color; }" ) ) input
#> /* Sass */ #> $color: blue; #> @import "/private/var/folders/t8/jxw4bftj35g15fcb6m4mfbc80000gn/T/Rtmp4wcBoh/variablesbb3c18d90a04"; #> body { color: $color; }
# The final body color is red sass(input)
#> /* CSS */ #> body { #> color: "red"; #> } #>
# }