First stable release of dart-sass-embedded

Moments later the first stable release was superseded by the second stable release, which was superseded by the third stable release a few minutes after that.

https://github.com/sass/dart-sass-embedded/releases/latest

Bash script to download and install latest for Linux
base=https://github.com && temp=dart-sass-embedded.tar.gz
path=$(curl -sL https://github.com/sass/dart-sass-embedded/releases/latest | grep "href.*linux-x64.tar.gz" | awk -F'"' '{print $2}')
wget -qO $temp $base$path
tar -xvzf $temp
sudo mv sass_embedded/dart-sass-embedded /usr/local/bin/
sudo chmod 755 /usr/local/bin/dart-sass-embedded
rm $temp
rm -r sass_embedded/ 
dart-sass-embedded --version

Example of using it in your templates
{{/* Get Sass resource. */}}
{{ $scss := resources.Get "scss/main.scss" }}

{{/* Transpile to generate a short cache-busting target path. */}}
{{ $css := $scss | toCSS }}
{{ $cacheBuster := $css.Content | sha1 | first 7 }}
{{ $targetPath := printf "css/style.%s.css" $cacheBuster }}

{{/* Transpile again with options. */}}
{{ $options := dict "targetPath" $targetPath "transpiler" "dartsass" }}
{{ $css := $scss | toCSS $options | minify }}
{{ $temp := $css | fingerprint "sha512" }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $temp.Data.Integrity }}" crossorigin="anonymous">

{{/* 
  This produces something like:
  <link rel="stylesheet" href="/css/style.8105fcf.min.css" integrity="sha512-..." crossorigin="anonymous">
*/}}
3 Likes