Fix: normalize version
This commit is contained in:
parent
da5626a6d7
commit
56e669fbcf
|
@ -446,6 +446,9 @@ var usercss = (function () {
|
||||||
parseStringToEnd(state);
|
parseStringToEnd(state);
|
||||||
usercssData[state.key] = state.value;
|
usercssData[state.key] = state.value;
|
||||||
}
|
}
|
||||||
|
if (state.key === 'version') {
|
||||||
|
usercssData[state.key] = normalizeVersion(usercssData[state.key]);
|
||||||
|
}
|
||||||
if (METAS[state.key]) {
|
if (METAS[state.key]) {
|
||||||
style[state.key] = usercssData[state.key];
|
style[state.key] = usercssData[state.key];
|
||||||
}
|
}
|
||||||
|
@ -460,6 +463,14 @@ var usercss = (function () {
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeVersion(version) {
|
||||||
|
// https://docs.npmjs.com/misc/semver#versions
|
||||||
|
if (version[0] === 'v' || version[0] === '=') {
|
||||||
|
return version.slice(1);
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
function buildCode(style) {
|
function buildCode(style) {
|
||||||
const {usercssData: {preprocessor, vars}, sourceCode} = style;
|
const {usercssData: {preprocessor, vars}, sourceCode} = style;
|
||||||
let builder;
|
let builder;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user