From: Jenny Rakoczy Date: Mon, 5 Sep 2022 18:54:34 +0000 (-0400) Subject: scss: Handle single-file sourcemaps correctly X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=02c89a446;p=brevno-suite%2Fhugo scss: Handle single-file sourcemaps correctly Simple sites may only have one css file. Update the replace directive to correctly match single-file sourcemaps and multi-file sourcemaps. Verified locally with and without SASS and CSS imports. Fixes #8174 --- diff --git a/resources/resource_transformers/tocss/scss/tocss.go b/resources/resource_transformers/tocss/scss/tocss.go index 57ac16711..10bd1f6f8 100644 --- a/resources/resource_transformers/tocss/scss/tocss.go +++ b/resources/resource_transformers/tocss/scss/tocss.go @@ -163,7 +163,7 @@ func (t *toCSSTransformation) Transform(ctx *resources.ResourceTransformationCtx // This is a workaround for what looks like a bug in Libsass. But // getting this resolution correct in tools like Chrome Workspaces // is important enough to go this extra mile. - mapContent := strings.Replace(res.SourceMapContent, `stdin",`, fmt.Sprintf("%s\",", sourcePath), 1) + mapContent := strings.Replace(res.SourceMapContent, `stdin"`, fmt.Sprintf("%s\"", sourcePath), 1) return ctx.PublishSourceMap(mapContent) }