index.js
function (customProperty, declaration) {
  customProperty.declarations.forEach(function (customDeclaration) {
    // No need to copy value here as replace will copy value
    var value = customDeclaration.value;

    // Replace parameter variables with user given values
    customDeclaration.variables.forEach(function (variable) {
      value = value.replace(customProperty.parameters[variable],
        declaration.values[variable]);
    });

    // Using cloneBefore to insert declaration provides sourcemap support
    declaration.cloneBefore({
      prop: customDeclaration.property,
      value: value
    });
  });

  declaration.remove();
}
function (customProperty, declaration) {
  customProperty.declarations.forEach(function (customDeclaration) {
    // No need to copy value here as replace will copy value
    var value = customDeclaration.value;

    // Replace parameter variables with user given values
    customDeclaration.variables.forEach(function (variable) {
      value = value.replace(customProperty.parameters[variable],
        declaration.values[variable]);
    });

    // Using cloneBefore to insert declaration provides sourcemap support
    declaration.cloneBefore({
      prop: customDeclaration.property,
      value: value
    });
  });

  declaration.remove();
}
function ( customProperty , declaration ) { customProperty . declarations . forEach ( function ( customDeclaration ) { // No need to copy value here as replace will copy value var value = customDeclaration . value ; // Replace parameter variables with user given values customDeclaration . variables . forEach ( function ( variable ) { value = value . replace ( customProperty . parameters [ variable ] , declaration . values [ variable ] ) ; } ) ; // Using cloneBefore to insert declaration provides sourcemap support declaration . cloneBefore ( { prop : customDeclaration . property , value : value } ) ; } ) ; declaration . remove ( ) ; }
Applies the custom property to the given declaration
Applies the custom property to the given declaration