Hi, I'm trying to convert an old property rule to a plugin for 2.0.
properties : [
{
name: 'swap-dashicons-left-right-arrows',
expr: /content/im,
action: function( prop, value ) {
if ( value === '"\\f141"' ) { // dashicons-arrow-left
value = '"\\f139"';
} else if ( value === '"\\f340"' ) { // dashicons-arrow-left-alt
value = '"\\f344"';
} else if ( value === '"\\f341"' ) { // dashicons-arrow-left-alt2
value = '"\\f345"';
} else if ( value === '"\\f139"' ) { // dashicons-arrow-right
value = '"\\f141"';
} else if ( value === '"\\f344"' ) { // dashicons-arrow-right-alt
value = '"\\f340"';
} else if ( value === '"\\f345"' ) { // dashicons-arrow-right-alt2
value = '"\\f341"';
}
return { prop: prop, value: value };
}
}
],
plugins: [
{
name: 'swap-dashicons-left-right-arrows',
priority: 10,
processors: { // The docs mention an array here, but it needs to be an object?
'property': [
{
expr: /content/im,
action: function( prop, value ) {
console.log(arguments);
if ( value === '"\\f141"' ) { // dashicons-arrow-left
value = '"\\f139"';
} else if ( value === '"\\f340"' ) { // dashicons-arrow-left-alt
value = '"\\f344"';
} else if ( value === '"\\f341"' ) { // dashicons-arrow-left-alt2
value = '"\\f345"';
} else if ( value === '"\\f139"' ) { // dashicons-arrow-right
value = '"\\f141"';
} else if ( value === '"\\f344"' ) { // dashicons-arrow-right-alt
value = '"\\f340"';
} else if ( value === '"\\f345"' ) { // dashicons-arrow-right-alt2
value = '"\\f341"';
}
return { prop: prop, value: value };
}
}
]
}
}
]
When I run the task I get a "Warning: Cannot read property 'value' of undefined Use --force to continue." error. After adding the directives: {},
attribute I get "Warning: Cannot read property 'length' of undefined Use --force to continue."
// …
Files: src/wp-includes/css/wp-pointer.css -> build/wp-includes/css/wp-pointer-rtl.css
Options: map=false, opts={"autoRename":false,"clean":false,"processUrls":{"atrule":true,"decl":false},"stringMap":[{"name":"import-rtl-stylesheet","exclusive":true,"search":[".css"],"replace":["-rtl.css"],"options":{"scope":"url","ignoreCase":false}}]}, plugins=[{"name":"swap-dashicons-left-right-arrows","priority":10,"directives":{},"processors":{"property":[{"expr":{}}]}}], saveUnmodified=false
Reading src/wp-admin/css/about.css...OK
Warning: Cannot read property 'length' of undefined Use --force to continue.