Skip to content

Commit 3f40e9a

Browse files
author
Ives van Hoorne
committed
Fix sass loader
1 parent 29913e5 commit 3f40e9a

File tree

3 files changed

+35
-28
lines changed

3 files changed

+35
-28
lines changed

src/sandbox/eval/manager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ export default class Manager {
218218
} else if (
219219
mirrorModule.code !== module.code ||
220220
mirrorModule.title !== module.title ||
221+
mirrorModule.isNotSynced !== module.isNotSynced ||
221222
mirrorModule.directoryShortid !== module.directoryShortid
222223
) {
223224
updatedModules.push(module);

src/sandbox/eval/transpilers/sass/sass-worker.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,29 @@ self.addEventListener('message', event => {
2828
});
2929

3030
Sass.clearFiles(() => {
31-
Sass.options({ sourceMapEmbed: true }, () => {
32-
Sass.writeFile(files, () => {
33-
Sass.compileFile(path, result => {
34-
if (result.status === 0) {
35-
self.postMessage({
36-
type: 'compiled',
37-
transpiledCode: result.text,
38-
});
39-
} else {
40-
self.postMessage({
41-
type: 'error',
42-
error: {
43-
name: 'CompileError',
44-
message: result.formatted,
45-
fileName: result.file && result.file.replace('/sass/', ''),
46-
},
47-
});
48-
}
31+
Sass.options(
32+
{ sourceMapEmbed: true, indentedSyntax: path.endsWith('.sass') },
33+
() => {
34+
Sass.writeFile(files, () => {
35+
Sass.compileFile(path, result => {
36+
if (result.status === 0) {
37+
self.postMessage({
38+
type: 'compiled',
39+
transpiledCode: result.text,
40+
});
41+
} else {
42+
self.postMessage({
43+
type: 'error',
44+
error: {
45+
name: 'CompileError',
46+
message: result.formatted,
47+
fileName: result.file && result.file.replace('/sass/', ''),
48+
},
49+
});
50+
}
51+
});
4952
});
50-
});
51-
});
53+
}
54+
);
5255
});
5356
});

src/sandbox/eval/transpilers/vue/loader.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ const getStyleFileName = attrs => {
1717
return attrs.module ? `module.${extension}` : extension;
1818
};
1919

20-
const getStyleLoaders = attrs => {
21-
let loader = '!style-loader';
20+
const getStyleLoaders = (attrs, id, scoped) => {
21+
let loader = `!style-loader!vue-style-compiler?${JSON.stringify({
22+
id,
23+
scoped: !!scoped,
24+
})}`;
25+
2226
if (attrs.module) {
2327
loader += `?${JSON.stringify({ module: true })}`;
2428
}
@@ -227,12 +231,11 @@ export default function(code: string, loaderContext: LoaderContext) {
227231

228232
function getRequire(type, impt, i = 0, scoped) {
229233
if (type === 'style') {
230-
var styleCompiler = `${getStyleLoaders(
231-
impt.attrs
232-
)}!vue-style-compiler?${JSON.stringify({
233-
id: moduleId,
234-
scoped: !!scoped,
235-
})}!${moduleTitle}:style-${i}.vue.${getStyleFileName(impt.attrs)}`;
234+
const styleCompiler = `${getStyleLoaders(
235+
impt.attrs,
236+
moduleId,
237+
!!scoped
238+
)}!${moduleTitle}:style-${i}.vue.${getStyleFileName(impt.attrs)}`;
236239

237240
const tModule = loaderContext.emitModule(styleCompiler, impt.content);
238241

0 commit comments

Comments
 (0)