You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the library to compile the scss during runtime by using renderSync and modifying the require function to inject the compiled scss into the dom, I want to embed the sourceMap and the source to css output.
The following will not work:
let rendered = sass.renderSync({
file: "./source/test.scss",
sourceMapContents: true,
sourceMapEmbed: true
});
let style = rendered.css.toString();
This code will also not work:
let rendered = sass.renderSync({
file: "./source/test.scss",
sourceMap: true,
sourceMapContents: true,
sourceMapEmbed: true
});
let style = rendered.css.toString();
I could only get it to work by specifying the sourceMap parameter as a string, but I would expect that to produce a file for the sourceMap, like so:
let rendered = sass.renderSync({
file: "./source/test.scss",
sourceMap: "",
sourceMapContents: true,
sourceMapEmbed: true
});
let style = rendered.css.toString();
Expected behavior: sourceMapEmbed and sourceMapContents should still work while compiling to string, either by having the sourceMap set to true or not requiring sourceMap to be set at all.
The text was updated successfully, but these errors were encountered:
JohnyCilohokla
changed the title
sourceMapEmbed and sourceMapContents doesn't work while compiling to string
sourceMapEmbed and sourceMapContents doesn't work as expected while compiling to string
Aug 6, 2021
It's unintuitive, but the JS API docs do specify that sourceMap: true will be ignored if outFile is not set. Passing a string when you want an embedded source map is indeed what you should do here.
We do have a proposal out for a new JS API (that's not yet available, but will be in the future) if you have any comments on it: sass/sass#3056
I'm using the library to compile the scss during runtime by using renderSync and modifying the require function to inject the compiled scss into the dom, I want to embed the sourceMap and the source to css output.
The following will not work:
This code will also not work:
I could only get it to work by specifying the sourceMap parameter as a string, but I would expect that to produce a file for the sourceMap, like so:
Expected behavior: sourceMapEmbed and sourceMapContents should still work while compiling to string, either by having the sourceMap set to true or not requiring sourceMap to be set at all.
The text was updated successfully, but these errors were encountered: