Initialize variables later
This commit is contained in:
parent
6b4bb762aa
commit
2d4ec5380e
1 changed files with 3 additions and 1 deletions
|
@ -15,12 +15,13 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const valueParser = require("postcss-value-parser");
|
const valueParser = require("postcss-value-parser");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This plugin extracts content inside url() into css variables.
|
* This plugin extracts content inside url() into css variables.
|
||||||
* The extracted css variables are added to the :root section.
|
* The extracted css variables are added to the :root section.
|
||||||
*/
|
*/
|
||||||
let counter;
|
let counter;
|
||||||
const urlVariables = new Map();
|
let urlVariables;
|
||||||
const idToPrepend = "icon-url";
|
const idToPrepend = "icon-url";
|
||||||
|
|
||||||
function extractUrl(decl) {
|
function extractUrl(decl) {
|
||||||
|
@ -58,6 +59,7 @@ function addResolvedVariablesToRootSelector(root, { Rule, Declaration }) {
|
||||||
* @type {import('postcss').PluginCreator}
|
* @type {import('postcss').PluginCreator}
|
||||||
*/
|
*/
|
||||||
module.exports = (opts = {}) => {
|
module.exports = (opts = {}) => {
|
||||||
|
urlVariables = new Map();
|
||||||
counter = 0;
|
counter = 0;
|
||||||
return {
|
return {
|
||||||
postcssPlugin: "postcss-url-to-variable",
|
postcssPlugin: "postcss-url-to-variable",
|
||||||
|
|
Reference in a new issue