Skip to content

Commit

Permalink
Update to use the Dart Sass binary and the new v2 protocol
Browse files Browse the repository at this point in the history
E.g. use `sass --embedded`.

Note taht this will bumb to a new major version of this library (v2).

If you need to support the old protocol/binary, use the v1 (root path) version.

See gohugoio/hugo#11059
Fixes #15
  • Loading branch information
bep committed Jun 8, 2023
1 parent 9f9f1c1 commit c761af1
Show file tree
Hide file tree
Showing 7 changed files with 643 additions and 688 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
name: Test
env:
DART_SASS_VERSION: 1.56.1
SASS_VERSION: 1.56.1
jobs:
test:
strategy:
Expand All @@ -19,24 +19,24 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: Install dart-sass-embedded Linux
- name: Install dart-sass Linux
if: matrix.os == 'ubuntu-latest'
run: |
curl -LJO "https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz";
tar -xvf "sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz";
echo "DART_SASS_EMBEDDED_BINARY=$GITHUB_WORKSPACE/sass_embedded/dart-sass-embedded" >> $GITHUB_ENV
- name: Install dart-sass-embedded MacOS
curl -LJO "https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-arm64.tar.gz";
tar -xvf "dart-sass-${SASS_VERSION}-linux-arm64.tar.gz";
echo "DART_SASS_BINARY=$GITHUB_WORKSPACE/dart-sass/sass" >> $GITHUB_ENV
- name: Install dart-sass MacOS
if: matrix.os == 'macos-latest'
run: |
curl -LJO "https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz";
tar -xvf "sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz";
echo "DART_SASS_EMBEDDED_BINARY=$GITHUB_WORKSPACE/sass_embedded/dart-sass-embedded" >> $GITHUB_ENV
- name: Install dart-sass-embedded Windows
curl -LJO https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-macos-x64.tar.gz";
tar -xvf "dart-sass-${SASS_VERSION}-macos-x64.tar.gz";
echo "DART_SASS_BINARY=$GITHUB_WORKSPACE/dart-sass/sass" >> $GITHUB_ENV
- name: Install dart-sass Windows
if: matrix.os == 'windows-latest'
run: |
curl -LJO "https://github.com/sass/dart-sass-embedded/releases/download/${env:DART_SASS_VERSION}/sass_embedded-${env:DART_SASS_VERSION}-windows-x64.zip";
Expand-Archive -Path "sass_embedded-${env:DART_SASS_VERSION}-windows-x64.zip" -DestinationPath .;
echo "DART_SASS_EMBEDDED_BINARY=$env:GITHUB_WORKSPACE/sass_embedded/dart-sass-embedded.bat" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
curl -LJO "https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-windows-x64.zip";
Expand-Archive -Path "dart-sass-${env:SASS_VERSION}-windows-x64.zip" -DestinationPath .;
echo "DART_SASS_BINARY=$env:GITHUB_WORKSPACE/dart-sass/sass.bat" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Test
run: go test -race . -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage
Expand Down
4 changes: 2 additions & 2 deletions internal/embeddedsass/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

* Install protobuf: https://github.com/protocolbuffers/protobuf
* Install the Go plugin: go get -u google.golang.org/protobuf/cmd/protoc-gen-go
* Download the correct version of the proto file: https://github.com/sass/embedded-protocol/blob/master/embedded_sass.proto
* Install the Go plugin: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
* Download the correct version of the proto file: https://github.com/sass/sass/blob/main/spec/embedded_sass.proto
* protoc --go_opt=Membedded_sass.proto=github.com/bep/godartsass/internal/embeddedsass --go_opt=paths=source_relative --go_out=. embedded_sass.proto
Loading

0 comments on commit c761af1

Please sign in to comment.