| @@ -19,8 +19,20 @@ | ||
| 19 | 19 | (css) => |
| 20 | 20 | css.walkRules((rule) => { |
| 21 | 21 | // Removes top level TW styles like *::before {} |
| 22 | 22 | rule.selector.startsWith('*') && rule.remove(); |
| 23 | + | |
| 24 | + // This will allow users to override something like | |
| 25 | + // padding within the block styles | |
| 26 | + if (file.endsWith('style.css')) { | |
| 27 | + // This appends the :not() exception to padding and margins | |
| 28 | + if (new RegExp('[:]?[^a-z]-?p[a-z]?-.+').test(rule)) { | |
| 29 | + rule.selector += ':not([style*="padding"])'; | |
| 30 | + } | |
| 31 | + if (new RegExp('[:]?[^a-z]-?m[a-z]?-.+').test(rule)) { | |
| 32 | + rule.selector += ':not([style*="margin"])'; | |
| 33 | + } | |
| 34 | + } | |
| 23 | 35 | }), |
| 24 | 36 | // See: https://github.com/WordPress/gutenberg/blob/trunk/packages/postcss-plugins-preset/lib/index.js |
| 25 | 37 | require('autoprefixer')({ grid: true }), |
| 26 | 38 | !file.endsWith('editor.css') && require('postcss-safe-important'), |