@maizzle/framework 4.0.0-alpha.8 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.editorconfig +9 -9
  2. package/.github/media/logo-dark.svg +1 -0
  3. package/.github/media/logo-light.svg +1 -0
  4. package/.github/workflows/nodejs.yml +28 -28
  5. package/LICENSE +21 -21
  6. package/README.md +42 -35
  7. package/bin/maizzle +3 -0
  8. package/package.json +91 -87
  9. package/src/commands/serve.js +15 -5
  10. package/src/generators/config.js +32 -32
  11. package/src/generators/output/index.js +4 -4
  12. package/src/generators/output/to-disk.js +208 -208
  13. package/src/generators/output/to-string.js +67 -71
  14. package/src/generators/postcss.js +29 -29
  15. package/src/generators/posthtml.js +66 -66
  16. package/src/generators/tailwindcss.js +116 -116
  17. package/src/index.js +17 -17
  18. package/src/transformers/attributeToStyle.js +90 -90
  19. package/src/transformers/baseUrl.js +69 -45
  20. package/src/transformers/extraAttributes.js +26 -26
  21. package/src/transformers/filters/defaultFilters.js +126 -0
  22. package/src/transformers/{transform.js → filters/index.js} +55 -51
  23. package/src/transformers/index.js +63 -60
  24. package/src/transformers/inlineCss.js +37 -50
  25. package/src/transformers/markdown.js +19 -19
  26. package/src/transformers/minify.js +21 -21
  27. package/src/transformers/plaintext.js +23 -23
  28. package/src/transformers/posthtmlMso.js +10 -10
  29. package/src/transformers/prettify.js +27 -20
  30. package/src/transformers/preventWidows.js +13 -13
  31. package/src/transformers/removeAttributes.js +17 -17
  32. package/src/transformers/removeInlineBackgroundColor.js +52 -52
  33. package/src/transformers/removeInlineSizes.js +41 -41
  34. package/src/transformers/removeInlinedSelectors.js +70 -71
  35. package/src/transformers/removeUnusedCss.js +40 -35
  36. package/src/transformers/replaceStrings.js +14 -14
  37. package/src/transformers/safeClassNames.js +24 -24
  38. package/src/transformers/shorthandInlineCSS.js +19 -0
  39. package/src/transformers/sixHex.js +33 -33
  40. package/src/transformers/urlParameters.js +17 -17
  41. package/src/utils/helpers.js +17 -17
  42. package/test/expected/posthtml/component.html +13 -13
  43. package/test/expected/posthtml/extend-template.html +2 -2
  44. package/test/expected/posthtml/fetch.html +5 -5
  45. package/test/expected/posthtml/layout.html +3 -3
  46. package/test/expected/transformers/atimport-in-style.html +2 -1
  47. package/test/expected/transformers/{base-image-url.html → base-url.html} +18 -2
  48. package/test/expected/transformers/filters.html +81 -0
  49. package/test/expected/transformers/preserve-transform-css.html +12 -3
  50. package/test/expected/useConfig.html +9 -9
  51. package/test/fixtures/basic.html +6 -6
  52. package/test/fixtures/posthtml/component.html +19 -19
  53. package/test/fixtures/posthtml/extend-template.html +7 -7
  54. package/test/fixtures/posthtml/fetch.html +9 -9
  55. package/test/fixtures/posthtml/layout.html +11 -11
  56. package/test/fixtures/transformers/{base-image-url.html → base-url.html} +18 -2
  57. package/test/fixtures/transformers/filters.html +87 -0
  58. package/test/fixtures/useConfig.html +9 -9
  59. package/test/stubs/assets/foo.bar +1 -1
  60. package/test/stubs/breaking/bad.html +5 -5
  61. package/test/stubs/components/component.html +5 -5
  62. package/test/stubs/config/config.js +10 -10
  63. package/test/stubs/config/config.maizzle-ci.js +10 -10
  64. package/test/stubs/data.json +14 -14
  65. package/test/stubs/events/before-create.html +1 -1
  66. package/test/stubs/layouts/basic.html +1 -1
  67. package/test/stubs/layouts/full.html +12 -12
  68. package/test/stubs/layouts/template.html +5 -5
  69. package/test/stubs/main.css +5 -5
  70. package/test/stubs/tailwind/content-source.html +1 -1
  71. package/test/stubs/tailwind/tailwind.css +3 -3
  72. package/test/stubs/template.html +10 -10
  73. package/test/stubs/templates/1.html +1 -1
  74. package/test/stubs/templates/2.test +1 -0
  75. package/test/test-config.js +19 -19
  76. package/test/test-postcss.js +8 -8
  77. package/test/test-posthtml.js +72 -66
  78. package/test/test-tailwindcss.js +117 -117
  79. package/test/test-todisk.js +42 -28
  80. package/test/test-tostring.js +148 -142
  81. package/test/test-transformers.js +78 -46
  82. package/xo.config.js +22 -22
  83. package/test/stubs/templates/2.html +0 -1
  84. package/test/stubs/templates/3.mzl +0 -1
@@ -1,19 +1,19 @@
1
- const posthtml = require('posthtml')
2
- const {get, merge} = require('lodash')
3
- const markdown = require('posthtml-markdownit')
4
-
5
- module.exports = async (html, config = {}, direct = false) => {
6
- if (get(config, 'markdown') === false) {
7
- return html
8
- }
9
-
10
- const userMarkdownOptions = direct ? config : get(config, 'markdown', {})
11
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
12
- const markdownOptions = merge({markdownit: {html: true}}, userMarkdownOptions)
13
-
14
- return posthtml([
15
- markdown({...markdownOptions})
16
- ])
17
- .process(html, posthtmlOptions)
18
- .then(result => result.html)
19
- }
1
+ const posthtml = require('posthtml')
2
+ const {get, merge} = require('lodash')
3
+ const markdown = require('posthtml-markdownit')
4
+
5
+ module.exports = async (html, config = {}, direct = false) => {
6
+ if (get(config, 'markdown') === false) {
7
+ return html
8
+ }
9
+
10
+ const userMarkdownOptions = direct ? config : get(config, 'markdown', {})
11
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
12
+ const markdownOptions = merge({markdownit: {html: true}}, userMarkdownOptions)
13
+
14
+ return posthtml([
15
+ markdown({...markdownOptions})
16
+ ])
17
+ .process(html, posthtmlOptions)
18
+ .then(result => result.html)
19
+ }
@@ -1,21 +1,21 @@
1
- const {crush} = require('html-crush')
2
- const {get, isEmpty} = require('lodash')
3
-
4
- module.exports = async (html, config = {}, direct = false) => {
5
- if (get(config, 'minify') === false) {
6
- return html
7
- }
8
-
9
- config = direct ? {
10
- lineLengthLimit: 500,
11
- removeIndentations: true,
12
- removeLineBreaks: true,
13
- ...config
14
- } : get(config, 'minify', {})
15
-
16
- if (!isEmpty(config)) {
17
- html = crush(html, {removeLineBreaks: true, ...config}).result
18
- }
19
-
20
- return html
21
- }
1
+ const {crush} = require('html-crush')
2
+ const {get, isEmpty} = require('lodash')
3
+
4
+ module.exports = async (html, config = {}, direct = false) => {
5
+ if (get(config, 'minify') === false) {
6
+ return html
7
+ }
8
+
9
+ config = direct ? {
10
+ lineLengthLimit: 500,
11
+ removeIndentations: true,
12
+ removeLineBreaks: true,
13
+ ...config
14
+ } : get(config, 'minify', {})
15
+
16
+ if (!isEmpty(config)) {
17
+ html = crush(html, {removeLineBreaks: true, ...config}).result
18
+ }
19
+
20
+ return html
21
+ }
@@ -1,23 +1,23 @@
1
- const {get} = require('lodash')
2
- const posthtml = require('posthtml')
3
-
4
- module.exports = (html, config = {}) => {
5
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
6
-
7
- return posthtml([plaintext()]).process(html, {...posthtmlOptions, sync: true}).html
8
- }
9
-
10
- const plaintext = () => tree => {
11
- const process = node => {
12
- if (node.tag === 'plaintext') {
13
- return {
14
- tag: false,
15
- content: ['']
16
- }
17
- }
18
-
19
- return node
20
- }
21
-
22
- return tree.walk(process)
23
- }
1
+ const {get} = require('lodash')
2
+ const posthtml = require('posthtml')
3
+
4
+ module.exports = (html, config = {}) => {
5
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
6
+
7
+ return posthtml([plaintext()]).process(html, {...posthtmlOptions, sync: true}).html
8
+ }
9
+
10
+ const plaintext = () => tree => {
11
+ const process = node => {
12
+ if (node.tag === 'plaintext') {
13
+ return {
14
+ tag: false,
15
+ content: ['']
16
+ }
17
+ }
18
+
19
+ return node
20
+ }
21
+
22
+ return tree.walk(process)
23
+ }
@@ -1,10 +1,10 @@
1
- const {get} = require('lodash')
2
- const posthtml = require('posthtml')
3
- const outlook = require('posthtml-mso')
4
-
5
- module.exports = async (html, config) => {
6
- const outlookOptions = get(config, 'build.posthtml.outlook', {})
7
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
8
-
9
- return posthtml([outlook({...outlookOptions})]).process(html, {...posthtmlOptions}).then(result => result.html)
10
- }
1
+ const {get} = require('lodash')
2
+ const posthtml = require('posthtml')
3
+ const outlook = require('posthtml-mso')
4
+
5
+ module.exports = async (html, config) => {
6
+ const outlookOptions = get(config, 'build.posthtml.outlook', {})
7
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
8
+
9
+ return posthtml([outlook({...outlookOptions})]).process(html, {...posthtmlOptions}).then(result => result.html)
10
+ }
@@ -1,20 +1,27 @@
1
- const pretty = require('pretty')
2
- const {get, isEmpty} = require('lodash')
3
-
4
- module.exports = async (html, config = {}, direct = false) => {
5
- if (get(config, 'prettify') === false) {
6
- return html
7
- }
8
-
9
- config = direct ? config : get(config, 'prettify', {})
10
-
11
- if (typeof config === 'boolean' && config) {
12
- return pretty(html)
13
- }
14
-
15
- if (!isEmpty(config)) {
16
- return pretty(html, config)
17
- }
18
-
19
- return html
20
- }
1
+ /* eslint-disable camelcase */
2
+ const pretty = require('pretty')
3
+ const {get, merge, isEmpty, isObject} = require('lodash')
4
+
5
+ module.exports = async (html, config = {}, direct = false) => {
6
+ const defaultConfig = {
7
+ space_around_combinator: true, // Preserve space around CSS selector combinators
8
+ newline_between_rules: false, // Remove empty lines between CSS rules
9
+ indent_inner_html: false, // Helps reduce file size
10
+ extra_liners: [] // Don't add extra new line before any tag
11
+ }
12
+
13
+ config = direct ? config : get(config, 'prettify')
14
+
15
+ // Don't prettify if not explicitly enabled in config
16
+ if (!config || (isObject(config) && isEmpty(config))) {
17
+ return html
18
+ }
19
+
20
+ if (typeof config === 'boolean' && config) {
21
+ return pretty(html, defaultConfig)
22
+ }
23
+
24
+ config = merge(defaultConfig, config)
25
+
26
+ return pretty(html, config)
27
+ }
@@ -1,13 +1,13 @@
1
- const {get} = require('lodash')
2
- const posthtml = require('posthtml')
3
- const preventWidows = require('prevent-widows')
4
-
5
- module.exports = async (html, config = {}, direct = false) => {
6
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
7
-
8
- if (direct) {
9
- return preventWidows(html)
10
- }
11
-
12
- return posthtml([preventWidows.posthtml()]).process(html, posthtmlOptions).then(result => result.html)
13
- }
1
+ const {get} = require('lodash')
2
+ const posthtml = require('posthtml')
3
+ const preventWidows = require('prevent-widows')
4
+
5
+ module.exports = async (html, config = {}, direct = false) => {
6
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
7
+
8
+ if (direct) {
9
+ return preventWidows(html)
10
+ }
11
+
12
+ return posthtml([preventWidows.posthtml()]).process(html, posthtmlOptions).then(result => result.html)
13
+ }
@@ -1,17 +1,17 @@
1
- const {get} = require('lodash')
2
- const posthtml = require('posthtml')
3
- const removeAttributes = require('posthtml-remove-attributes')
4
-
5
- module.exports = async (html, config = {}, direct = false) => {
6
- const attributes = direct ? (Array.isArray(config) ? [...config] : []) : get(config, 'removeAttributes', [])
7
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
8
-
9
- attributes.push({name: 'style'}, {name: 'class'})
10
-
11
- // Allow omitting `value` key when removing empty attributes
12
- attributes.forEach(attr => {
13
- attr.value = attr.value || ''
14
- })
15
-
16
- return posthtml([removeAttributes(attributes)]).process(html, posthtmlOptions).then(result => result.html)
17
- }
1
+ const {get} = require('lodash')
2
+ const posthtml = require('posthtml')
3
+ const removeAttributes = require('posthtml-remove-attributes')
4
+
5
+ module.exports = async (html, config = {}, direct = false) => {
6
+ const attributes = direct ? (Array.isArray(config) ? [...config] : []) : get(config, 'removeAttributes', [])
7
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
8
+
9
+ attributes.push({name: 'style'}, {name: 'class'})
10
+
11
+ // Allow omitting `value` key when removing empty attributes
12
+ attributes.forEach(attr => {
13
+ attr.value = attr.value || ''
14
+ })
15
+
16
+ return posthtml([removeAttributes(attributes)]).process(html, posthtmlOptions).then(result => result.html)
17
+ }
@@ -1,52 +1,52 @@
1
- const posthtml = require('posthtml')
2
- const {get, isEmpty} = require('lodash')
3
- const parseAttrs = require('posthtml-attrs-parser')
4
-
5
- module.exports = async (html, config = {}, direct = false) => {
6
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
7
-
8
- if (isEmpty(config)) {
9
- return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
10
- }
11
-
12
- if (get(config, 'inlineCSS.preferBgColorAttribute') === true) {
13
- return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
14
- }
15
-
16
- const tags = direct ? (Array.isArray(config) ? config : false) : get(config, 'inlineCSS.preferBgColorAttribute', false)
17
-
18
- if (Array.isArray(tags)) {
19
- return posthtml([removeInlineBGColor({tags})]).process(html, posthtmlOptions).then(result => result.html)
20
- }
21
-
22
- return html
23
- }
24
-
25
- const removeInlineBGColor = (options = {}) => tree => {
26
- options.tags = options.tags || ['body', 'marquee', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr']
27
-
28
- const process = node => {
29
- if (!options.tags.includes(node.tag)) {
30
- return node
31
- }
32
-
33
- const attrs = parseAttrs(node.attrs, {
34
- rules: {
35
- bgcolor: {
36
- delimiter: /\s+/,
37
- glue: ' '
38
- }
39
- }
40
- })
41
-
42
- if (attrs.style && attrs.style['background-color']) {
43
- attrs.bgcolor = attrs.style['background-color']
44
- delete attrs.style['background-color']
45
- node.attrs = attrs.compose()
46
- }
47
-
48
- return node
49
- }
50
-
51
- return tree.walk(process)
52
- }
1
+ const posthtml = require('posthtml')
2
+ const {get, isEmpty} = require('lodash')
3
+ const parseAttrs = require('posthtml-attrs-parser')
4
+
5
+ module.exports = async (html, config = {}, direct = false) => {
6
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
7
+
8
+ if (isEmpty(config)) {
9
+ return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
10
+ }
11
+
12
+ if (get(config, 'inlineCSS.preferBgColorAttribute') === true) {
13
+ return posthtml([removeInlineBGColor()]).process(html, posthtmlOptions).then(result => result.html)
14
+ }
15
+
16
+ const tags = direct ? (Array.isArray(config) ? config : false) : get(config, 'inlineCSS.preferBgColorAttribute', false)
17
+
18
+ if (Array.isArray(tags)) {
19
+ return posthtml([removeInlineBGColor({tags})]).process(html, posthtmlOptions).then(result => result.html)
20
+ }
21
+
22
+ return html
23
+ }
24
+
25
+ const removeInlineBGColor = (options = {}) => tree => {
26
+ options.tags = options.tags || ['body', 'marquee', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr']
27
+
28
+ const process = node => {
29
+ if (!options.tags.includes(node.tag)) {
30
+ return node
31
+ }
32
+
33
+ const attrs = parseAttrs(node.attrs, {
34
+ rules: {
35
+ bgcolor: {
36
+ delimiter: /\s+/,
37
+ glue: ' '
38
+ }
39
+ }
40
+ })
41
+
42
+ if (attrs.style && attrs.style['background-color']) {
43
+ attrs.bgcolor = attrs.style['background-color']
44
+ delete attrs.style['background-color']
45
+ node.attrs = attrs.compose()
46
+ }
47
+
48
+ return node
49
+ }
50
+
51
+ return tree.walk(process)
52
+ }
@@ -1,41 +1,41 @@
1
- const posthtml = require('posthtml')
2
- const {get, isEmpty} = require('lodash')
3
- const parseAttrs = require('posthtml-attrs-parser')
4
-
5
- module.exports = async (html, config = {}, direct = false) => {
6
- const settings = direct ? config : get(config, 'inlineCSS.keepOnlyAttributeSizes', {})
7
-
8
- if (!isEmpty(settings)) {
9
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
10
- return posthtml([removeInlineSizes(settings)]).process(html, posthtmlOptions).then(result => result.html)
11
- }
12
-
13
- return html
14
- }
15
-
16
- const removeInlineSizes = (mappings = {}) => tree => {
17
- const process = node => {
18
- const attrs = parseAttrs(node.attrs)
19
- const tag = node.tag ? node.tag.toUpperCase() : ''
20
-
21
- Object.entries(mappings).forEach(([attribute, tags]) => {
22
- tags = Object.values(tags)
23
-
24
- if (!tags.includes(tag)) {
25
- return node
26
- }
27
-
28
- tags.forEach(() => {
29
- if (attrs.style) {
30
- delete attrs.style[attribute]
31
- }
32
- })
33
- })
34
-
35
- node.attrs = attrs.compose()
36
-
37
- return node
38
- }
39
-
40
- return tree.walk(process)
41
- }
1
+ const posthtml = require('posthtml')
2
+ const {get, isEmpty} = require('lodash')
3
+ const parseAttrs = require('posthtml-attrs-parser')
4
+
5
+ module.exports = async (html, config = {}, direct = false) => {
6
+ const settings = direct ? config : get(config, 'inlineCSS.keepOnlyAttributeSizes', {})
7
+
8
+ if (!isEmpty(settings)) {
9
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
10
+ return posthtml([removeInlineSizes(settings)]).process(html, posthtmlOptions).then(result => result.html)
11
+ }
12
+
13
+ return html
14
+ }
15
+
16
+ const removeInlineSizes = (mappings = {}) => tree => {
17
+ const process = node => {
18
+ const attrs = parseAttrs(node.attrs)
19
+ const tag = node.tag ? node.tag.toUpperCase() : ''
20
+
21
+ Object.entries(mappings).forEach(([attribute, tags]) => {
22
+ tags = Object.values(tags)
23
+
24
+ if (!tags.includes(tag)) {
25
+ return node
26
+ }
27
+
28
+ tags.forEach(() => {
29
+ if (attrs.style) {
30
+ delete attrs.style[attribute]
31
+ }
32
+ })
33
+ })
34
+
35
+ node.attrs = attrs.compose()
36
+
37
+ return node
38
+ }
39
+
40
+ return tree.walk(process)
41
+ }
@@ -1,71 +1,70 @@
1
- const {get, has, remove} = require('lodash')
2
- const postcss = require('postcss')
3
- const posthtml = require('posthtml')
4
- const parseAttrs = require('posthtml-attrs-parser')
5
- const matchHelper = require('posthtml-match-helper')
6
-
7
- module.exports = async (html, config = {}) => {
8
- if (get(config, 'removeInlinedClasses') === false) {
9
- return html
10
- }
11
-
12
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
13
- return posthtml([plugin()]).process(html, posthtmlOptions).then(result => result.html)
14
- }
15
-
16
- const plugin = () => tree => {
17
- const process = node => {
18
- // For each style tag...
19
- if (node.tag === 'style') {
20
- const {root} = postcss().process(node.content)
21
-
22
- root.walkRules(rule => {
23
- // Skip media queries and such...
24
- if (rule.parent.type === 'atrule') {
25
- return
26
- }
27
-
28
- const {selector} = rule
29
- const prop = get(rule.nodes[0], 'prop')
30
-
31
- // If we find the selector in the HTML...
32
- tree.match(matchHelper(selector), n => {
33
- const parsedAttrs = parseAttrs(n.attrs)
34
- const classAttr = get(parsedAttrs, 'class', [])
35
- const styleAttr = get(parsedAttrs, 'style', {})
36
-
37
- // If the class is in the style attribute (inlined), remove it
38
- if (has(styleAttr, prop)) {
39
- // Remove the class attribute
40
- // console.log(styleAttr, prop, classAttr)
41
- remove(classAttr, s => selector.includes(s))
42
-
43
- // Remove the rule in the <style> tag
44
- rule.remove()
45
- }
46
-
47
- /**
48
- * Remove from <style> selectors that were used to create shorthand declarations
49
- * like `margin: 0 0 0 16px` (transformed with mergeLonghand when inlining).
50
- */
51
- Object.keys(styleAttr).forEach(key => {
52
- if (prop.includes(key)) {
53
- rule.remove()
54
- remove(classAttr, s => selector.includes(s))
55
- }
56
- })
57
-
58
- n.attrs = parsedAttrs.compose()
59
-
60
- return n
61
- })
62
- })
63
-
64
- node.content = root.toString()
65
- }
66
-
67
- return node
68
- }
69
-
70
- return tree.walk(process)
71
- }
1
+ const {get, has, remove} = require('lodash')
2
+ const postcss = require('postcss')
3
+ const posthtml = require('posthtml')
4
+ const parseAttrs = require('posthtml-attrs-parser')
5
+ const matchHelper = require('posthtml-match-helper')
6
+
7
+ module.exports = async (html, config = {}) => {
8
+ if (get(config, 'removeInlinedClasses') === false) {
9
+ return html
10
+ }
11
+
12
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
13
+ return posthtml([plugin()]).process(html, posthtmlOptions).then(result => result.html)
14
+ }
15
+
16
+ const plugin = () => tree => {
17
+ const process = node => {
18
+ // For each style tag...
19
+ if (node.tag === 'style') {
20
+ const {root} = postcss().process(node.content)
21
+
22
+ root.walkRules(rule => {
23
+ // Skip media queries and such...
24
+ if (rule.parent.type === 'atrule') {
25
+ return
26
+ }
27
+
28
+ const {selector} = rule
29
+ const prop = get(rule.nodes[0], 'prop')
30
+
31
+ // If we find the selector in the HTML...
32
+ tree.match(matchHelper(selector), n => {
33
+ const parsedAttrs = parseAttrs(n.attrs)
34
+ const classAttr = get(parsedAttrs, 'class', [])
35
+ const styleAttr = get(parsedAttrs, 'style', {})
36
+
37
+ // If the class is in the style attribute (inlined), remove it
38
+ if (has(styleAttr, prop)) {
39
+ // Remove the class attribute
40
+ remove(classAttr, s => selector.includes(s))
41
+
42
+ // Remove the rule in the <style> tag
43
+ rule.remove()
44
+ }
45
+
46
+ /**
47
+ * Remove from <style> selectors that were used to create shorthand declarations
48
+ * like `margin: 0 0 0 16px` (transformed with mergeLonghand when inlining).
49
+ */
50
+ Object.keys(styleAttr).forEach(key => {
51
+ if (prop.includes(key)) {
52
+ rule.remove()
53
+ remove(classAttr, s => selector.includes(s))
54
+ }
55
+ })
56
+
57
+ n.attrs = parsedAttrs.compose()
58
+
59
+ return n
60
+ })
61
+ })
62
+
63
+ node.content = root.toString()
64
+ }
65
+
66
+ return node
67
+ }
68
+
69
+ return tree.walk(process)
70
+ }