mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-26 16:20:09 +02:00
fix acss config with unquoted keys
This commit is contained in:
@@ -132,10 +132,18 @@ export function computeCss(userCode, mode, settings) {
|
||||
const html = code;
|
||||
const foundClasses = atomizer.findClassNames(html);
|
||||
var finalConfig;
|
||||
|
||||
// Regular expression to find unquoted keys: looks for word characters (including _) followed by a colon
|
||||
// and put them in quotes
|
||||
const fixedConfigJson = (settings.acssConfig || '{}').replace(
|
||||
/([{,]\s*)([^\s"{:]+)(\s*:\s*)/g,
|
||||
'$1"$2"$3'
|
||||
);
|
||||
|
||||
try {
|
||||
finalConfig = atomizer.getConfig(
|
||||
foundClasses,
|
||||
JSON.parse(settings.acssConfig)
|
||||
JSON.parse(fixedConfigJson)
|
||||
);
|
||||
} catch (e) {
|
||||
finalConfig = atomizer.getConfig(foundClasses, {});
|
||||
|
Reference in New Issue
Block a user