Initialize variables later

This commit is contained in:
RMidhunSuresh 2022-03-25 11:46:48 +05:30
parent 6b4bb762aa
commit 2d4ec5380e

View File

@ -15,12 +15,13 @@ limitations under the License.
*/
const valueParser = require("postcss-value-parser");
/**
* This plugin extracts content inside url() into css variables.
* The extracted css variables are added to the :root section.
*/
let counter;
const urlVariables = new Map();
let urlVariables;
const idToPrepend = "icon-url";
function extractUrl(decl) {
@ -58,6 +59,7 @@ function addResolvedVariablesToRootSelector(root, { Rule, Declaration }) {
* @type {import('postcss').PluginCreator}
*/
module.exports = (opts = {}) => {
urlVariables = new Map();
counter = 0;
return {
postcssPlugin: "postcss-url-to-variable",