# NOT RUN {
# Very slow to compile
fib_sass <- "@function fib($x) {
@if $x <= 1 {
@return $x
}
@return fib($x - 2) + fib($x - 1);
}
body {
width: fib(27);
}"
# Use a custom cache dir for the purposes of this example. Normally,
# you'd want to set the caching behavior using options().
temp_cache_dir <- tempfile("sass_cache_dir")
dir.create(temp_cache_dir)
cache_opts <- sass_cache_options(TRUE, cache_dir = temp_cache_dir)
# The first time this runs it will be very slow
system.time(sass(fib_sass, cache_options = cache_opts))
# But on subsequent calls, it should be very fast
system.time(sass(fib_sass, cache_options = cache_opts))
# }
Run the code above in your browser using DataCamp Workspace