[*Theme] Escape $, move escaping to generic instead of in each preproc

This commit is contained in:
Ducko 2021-06-20 12:16:56 +01:00 committed by Alyxia Sother
parent 42e2c02719
commit d05b6c17c5
No known key found for this signature in database
GPG Key ID: 355968D14144B739
3 changed files with 11 additions and 9 deletions

View File

@ -1,13 +1,13 @@
import { readFileSync, writeFileSync, mkdirSync, rmSync } from 'fs';
export default (themePath, repo) => {
const content = readFileSync(themePath);
const content = readFileSync(themePath, 'utf8');
const metaReg = /@([^ ]*) (.*)/g;
let manifest = {
main: 'index.js',
tags: ['theme', 'port']
tags: ['theme', 'port'],
};
let match;
@ -17,7 +17,7 @@ export default (themePath, repo) => {
value = value.trim();
// console.log(key, value);
// console.log(key, value);
switch (key) {
case 'name':
@ -33,11 +33,11 @@ export default (themePath, repo) => {
break;
case 'author':
manifest.authors = [ value ];
manifest.authors = [value];
break;
case 'authorId':
manifest.authors = [ value ];
manifest.authors = [value];
break;
}
}
@ -59,7 +59,7 @@ export default {
)
);
},
onRemove: async () => {
style.remove();
},

View File

@ -55,7 +55,9 @@ const discordVars = [
'--deprecated-text-input-prefix',
];
export default (manifest, content, repo) => {
export default (manifest, _content, repo) => {
const content = _content.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$/g, '\\$');
let variables = content.match(/--([^*!\n}]*): ([^*!\n}]*);/g) || [];
if (variables.length > 0)
variables = variables.map((x) => {

View File

@ -27,7 +27,7 @@ export default (manifestPath, repo) => {
pcManifest.theme = cssPath;
}
const content = readFileSync(pcManifest.theme, 'utf8').replace(/\\/g, '\\\\').replace(/`/g, '\\`');
const content = readFileSync(pcManifest.theme, 'utf8');
const jsCode = `// Generated by MS2Builder - pcTheme preprocessor / porter
let style;