Fix: window is undefined
This commit is contained in:
parent
9713c6a3be
commit
a7cfeb22e4
|
@ -94,7 +94,7 @@ function getUsercssCompiler(preprocessor) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const varDef = Object.keys(vars).map(key => `${key} = ${vars[key].value};\n`).join('');
|
const varDef = Object.keys(vars).map(key => `${key} = ${vars[key].value};\n`).join('');
|
||||||
if (!Error.captureStackTrace) Error.captureStackTrace = () => {};
|
if (!Error.captureStackTrace) Error.captureStackTrace = () => {};
|
||||||
window.stylus(varDef + source).render((err, output) => {
|
self.stylus(varDef + source).render((err, output) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,15 +106,15 @@ function getUsercssCompiler(preprocessor) {
|
||||||
},
|
},
|
||||||
less: {
|
less: {
|
||||||
preprocess(source, vars) {
|
preprocess(source, vars) {
|
||||||
if (!window.less) {
|
if (!self.less) {
|
||||||
window.less = {
|
self.less = {
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
useFileCache: false,
|
useFileCache: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
loadScript('/vendor/less/less.min.js');
|
loadScript('/vendor/less/less.min.js');
|
||||||
const varDefs = Object.keys(vars).map(key => `@${key}:${vars[key].value};\n`).join('');
|
const varDefs = Object.keys(vars).map(key => `@${key}:${vars[key].value};\n`).join('');
|
||||||
return window.less.render(varDefs + source)
|
return self.less.render(varDefs + source)
|
||||||
.then(({css}) => css);
|
.then(({css}) => css);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user