[*Theme] Escape $, move escaping to generic instead of in each preproc
This commit is contained in:
parent
42e2c02719
commit
d05b6c17c5
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue