Fix: normalize version
This commit is contained in:
parent
da5626a6d7
commit
56e669fbcf
|
@ -446,6 +446,9 @@ var usercss = (function () {
|
|||
parseStringToEnd(state);
|
||||
usercssData[state.key] = state.value;
|
||||
}
|
||||
if (state.key === 'version') {
|
||||
usercssData[state.key] = normalizeVersion(usercssData[state.key]);
|
||||
}
|
||||
if (METAS[state.key]) {
|
||||
style[state.key] = usercssData[state.key];
|
||||
}
|
||||
|
@ -460,6 +463,14 @@ var usercss = (function () {
|
|||
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) {
|
||||
const {usercssData: {preprocessor, vars}, sourceCode} = style;
|
||||
let builder;
|
||||
|
|
Loading…
Reference in New Issue
Block a user