Skip to content

Commit

Permalink
scss: Handle single-file sourcemaps correctly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
toothrot authored and bep committed Sep 6, 2022
1 parent 06c3ac6 commit 02c89a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resources/resource_transformers/tocss/scss/tocss.go
Expand Up @@ -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)
}
Expand Down

0 comments on commit 02c89a4

Please sign in to comment.