diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-12-02 09:26:38 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-12-05 16:36:45 +0100 |
commit | e93138dfdb07dba1b743aa1b374e6fb8d2ba46bf (patch) | |
tree | bc8cf1bb6780a112920aae32f7a6c2a312cda668 | |
parent | 7d16c3c0c18859bf52f101c5671ebc0ad74dee11 (diff) | |
download | hugo-e93138dfdb07dba1b743aa1b374e6fb8d2ba46bf.tar.gz hugo-e93138dfdb07dba1b743aa1b374e6fb8d2ba46bf.zip |
dartsass: Add sourceMapIncludeSources option
-rw-r--r-- | .github/workflows/test.yml | 31 | ||||
-rwxr-xr-x | docs/content/en/hugo-pipes/scss-sass.md | 3 | ||||
-rw-r--r-- | resources/resource_transformers/tocss/dartsass/client.go | 3 | ||||
-rw-r--r-- | resources/resource_transformers/tocss/dartsass/transform.go | 5 |
4 files changed, 25 insertions, 17 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1528da51e..26fa0ed74 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,17 +4,16 @@ on: pull_request: name: Test env: - DART_SASS_VERSION: 1.56.1 - DART_SASS_SHA_LINUX: c6dd75ab1acb2cab98982a32622c0ba631cfaa753e7bac84efd32c6c19ea9303 - DART_SASS_SHA_MACOS: df6f4813501f906ffc8f8af865452b037bc1c3a17448c4b8ffa3be82793eb0c8 - DART_SASS_SHA_WINDOWS: c8bf9c009afd6bbeb1742e010845b84e1021fdba6edc80b4dd1fbbee75354b39 + GOPROXY: https://proxy.golang.org + GO111MODULE: on + DART_SASS_VERSION: 1.56.1 + DART_SASS_SHA_LINUX: c6dd75ab1acb2cab98982a32622c0ba631cfaa753e7bac84efd32c6c19ea9303 + DART_SASS_SHA_MACOS: df6f4813501f906ffc8f8af865452b037bc1c3a17448c4b8ffa3be82793eb0c8 + DART_SASS_SHA_WINDOWS: c8bf9c009afd6bbeb1742e010845b84e1021fdba6edc80b4dd1fbbee75354b39 permissions: contents: read jobs: test: - env: - GOPROXY: https://proxy.golang.org - GO111MODULE: on strategy: matrix: # Note: We upgraded to Go 1.18 in Hugo v0.95.0 @@ -70,23 +69,25 @@ jobs: - if: matrix.os == 'ubuntu-latest' name: Install dart-sass-embedded Linux run: | - curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz; + echo "Install Dart Sass version ${DART_SASS_VERSION} ..." + curl -LJO "https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz"; echo "${DART_SASS_SHA_LINUX} sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz" | sha256sum -c; - tar -xvf sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz; + tar -xvf "sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz"; echo "$GITHUB_WORKSPACE/sass_embedded/" >> $GITHUB_PATH - if: matrix.os == 'macos-latest' name: Install dart-sass-embedded MacOS run: | - curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz; - echo "${DART_SASS_SHA_MACOS} sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz" | shasum -a 256 -c; - tar -xvf sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz; + echo "Install Dart Sass version ${DART_SASS_VERSION} ..." + curl -LJO "https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz"; + echo "${DART_SASS_SHA_MACOS} sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz" | shasum -a 256 -c; + tar -xvf "sass_embedded-${DART_SASS_VERSION}-macos-x64.tar.gz"; echo "$GITHUB_WORKSPACE/sass_embedded/" >> $GITHUB_PATH - if: matrix.os == 'windows-latest' name: Install dart-sass-embedded Windows run: | - curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-windows-x64.zip; - echo "${DART_SASS_SHA_WINDOWS} sass_embedded-${DART_SASS_VERSION}-windows-x64.zip" | sha256sum -c; - unzip sass_embedded-${DART_SASS_VERSION}-windows-x64.zip; + echo "Install Dart Sass version ${env:DART_SASS_VERSION} ..." + 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 "$env:GITHUB_WORKSPACE/sass_embedded/" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf-8 -Append - name: Check run: | diff --git a/docs/content/en/hugo-pipes/scss-sass.md b/docs/content/en/hugo-pipes/scss-sass.md index ad4a66b11..169c473d2 100755 --- a/docs/content/en/hugo-pipes/scss-sass.md +++ b/docs/content/en/hugo-pipes/scss-sass.md @@ -38,6 +38,9 @@ precision [int] enableSourceMap [bool] : When enabled, a source map will be generated. +sourceMapIncludeSources [bool] +: When enabled, sources will be embedded in the generated source map. (Dart Sass only). {{< new-in "0.108.0" >}} + includePaths [string slice] : Additional SCSS/Sass include paths. Paths must be relative to the project directory. diff --git a/resources/resource_transformers/tocss/dartsass/client.go b/resources/resource_transformers/tocss/dartsass/client.go index 7c3a7ecba..f5f42a6dc 100644 --- a/resources/resource_transformers/tocss/dartsass/client.go +++ b/resources/resource_transformers/tocss/dartsass/client.go @@ -127,6 +127,9 @@ type Options struct { // When enabled, Hugo will generate a source map. EnableSourceMap bool + + // If enabled, sources will be embedded in the generated source map. + SourceMapIncludeSources bool } func decodeOptions(m map[string]any) (opts Options, err error) { diff --git a/resources/resource_transformers/tocss/dartsass/transform.go b/resources/resource_transformers/tocss/dartsass/transform.go index 9d17d3bcc..3aca916fc 100644 --- a/resources/resource_transformers/tocss/dartsass/transform.go +++ b/resources/resource_transformers/tocss/dartsass/transform.go @@ -85,8 +85,9 @@ func (t *transform) Transform(ctx *resources.ResourceTransformationCtx) error { baseDir: baseDir, c: t.c, }, - OutputStyle: godartsass.ParseOutputStyle(opts.OutputStyle), - EnableSourceMap: opts.EnableSourceMap, + OutputStyle: godartsass.ParseOutputStyle(opts.OutputStyle), + EnableSourceMap: opts.EnableSourceMap, + SourceMapIncludeSources: opts.SourceMapIncludeSources, } // Append any workDir relative include paths |