Skip to content

Commit

Permalink
support for options in data-plugins to fix #8831
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed May 21, 2020
1 parent dcd23c7 commit 578eb5d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/babel-standalone/src/transformScriptTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,19 @@ function getPluginsOrPresetsFromScript(script, attributeName) {
// setting, and should use the default.
return null;
}
return rawValue.split(",").map(item => item.trim());
return rawValue.split(",").map(function (item) {
var value = item.trim();
// Allow options to be specified as 'plugin-name{opt1=v1,opt2=v2}'.
if (/\{.*\}$/.test(value)) {
const optionsRaw = value.replace(/^.*\{|\}$/g, "");
var options = {};
optionsRaw.split(",").forEach(function(opt) {
options[opt.split("=")[0]] = opt.split("=")[1];
})
return [value.replace(/\{.*\}$/, ""), options];
}
return value;
});
}

/**
Expand Down

0 comments on commit 578eb5d

Please sign in to comment.