Fix: various
This commit is contained in:
parent
53efd78b89
commit
cb5cbb4d10
|
@ -79,7 +79,7 @@
|
||||||
metaOnly,
|
metaOnly,
|
||||||
vars,
|
vars,
|
||||||
}) {
|
}) {
|
||||||
return Promise.resolve(usercss.buildMeta(sourceCode))
|
return usercss.buildMeta(sourceCode)
|
||||||
.then(style =>
|
.then(style =>
|
||||||
Promise.all([
|
Promise.all([
|
||||||
metaOnly ? style : doBuild(style),
|
metaOnly ? style : doBuild(style),
|
||||||
|
@ -98,31 +98,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the source, apply customizations, report fatal/syntax errors
|
// Build the style within aditional properties then inherit variable values
|
||||||
|
// from the old style.
|
||||||
function parse(style) {
|
function parse(style) {
|
||||||
return fetchStyle()
|
return buildMeta(style)
|
||||||
.then(buildMeta)
|
.then(buildMeta)
|
||||||
.then(assignVars)
|
.then(assignVars)
|
||||||
.then(usercss.buildCode);
|
.then(usercss.buildCode);
|
||||||
|
|
||||||
function fetchStyle() {
|
|
||||||
// restore if stripped by getStyleWithNoCode
|
|
||||||
if (typeof style.sourceCode !== 'string') {
|
|
||||||
return styleManager.get(style.id)
|
|
||||||
.then(oldStyle => {
|
|
||||||
style.sourceCode = oldStyle.sourceCode;
|
|
||||||
return style;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Promise.resolve(style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: simplify this to `installUsercss(sourceCode)`?
|
||||||
function installUsercss(style) {
|
function installUsercss(style) {
|
||||||
return parse(style)
|
return parse(style)
|
||||||
.then(styleManager.installStyle);
|
.then(styleManager.installStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: simplify this to `editSaveUsercss({sourceCode, exclusions})`?
|
||||||
function editSaveUsercss(style) {
|
function editSaveUsercss(style) {
|
||||||
return parse(style)
|
return parse(style)
|
||||||
.then(styleManager.editSave);
|
.then(styleManager.editSave);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user