@maizzle/framework 3.7.2 → 4.0.0-alpha.10

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/.github/workflows/nodejs.yml +28 -29
  2. package/bin/maizzle +3 -0
  3. package/package.json +91 -84
  4. package/src/commands/build.js +32 -0
  5. package/src/commands/serve.js +156 -0
  6. package/src/functions/plaintext.js +5 -0
  7. package/src/functions/render.js +5 -0
  8. package/src/generators/output/to-disk.js +120 -79
  9. package/src/generators/output/to-string.js +7 -8
  10. package/src/generators/plaintext.js +49 -52
  11. package/src/generators/postcss.js +29 -0
  12. package/src/generators/posthtml.js +66 -60
  13. package/src/generators/tailwindcss.js +116 -84
  14. package/src/index.js +14 -160
  15. package/src/transformers/{attribute-to-style.js → attributeToStyle.js} +0 -0
  16. package/src/transformers/baseUrl.js +69 -0
  17. package/src/transformers/{extra-attributes.js → extraAttributes.js} +0 -0
  18. package/src/transformers/filters/defaultFilters.js +126 -0
  19. package/src/transformers/filters/index.js +55 -0
  20. package/src/transformers/index.js +63 -57
  21. package/src/transformers/{inline.js → inlineCss.js} +1 -14
  22. package/src/transformers/minify.js +1 -1
  23. package/src/transformers/{posthtml-mso.js → posthtmlMso.js} +0 -0
  24. package/src/transformers/prettify.js +16 -9
  25. package/src/transformers/{prevent-widows.js → preventWidows.js} +0 -0
  26. package/src/transformers/{remove-attributes.js → removeAttributes.js} +1 -1
  27. package/src/transformers/{remove-inline-bgcolor.js → removeInlineBackgroundColor.js} +1 -1
  28. package/src/transformers/{remove-inline-sizes.js → removeInlineSizes.js} +0 -0
  29. package/src/transformers/removeInlinedSelectors.js +70 -0
  30. package/src/transformers/removeUnusedCss.js +40 -0
  31. package/src/transformers/{replace-strings.js → replaceStrings.js} +0 -0
  32. package/src/transformers/{safe-class-names.js → safeClassNames.js} +8 -2
  33. package/src/transformers/shorthandInlineCSS.js +19 -0
  34. package/src/transformers/sixHex.js +33 -0
  35. package/src/transformers/{url-params.js → urlParameters.js} +0 -0
  36. package/src/utils/helpers.js +2 -8
  37. package/test/expected/posthtml/component.html +13 -0
  38. package/test/expected/{inheritance.html → posthtml/extend-template.html} +2 -2
  39. package/test/expected/posthtml/fetch.html +5 -0
  40. package/test/expected/posthtml/layout.html +3 -0
  41. package/test/expected/transformers/atimport-in-style.html +15 -0
  42. package/test/expected/transformers/base-url.html +99 -0
  43. package/test/expected/transformers/filters.html +81 -0
  44. package/test/expected/transformers/preserve-transform-css.html +36 -0
  45. package/test/expected/useConfig.html +9 -0
  46. package/test/fixtures/basic.html +9 -9
  47. package/test/fixtures/posthtml/component.html +19 -0
  48. package/test/fixtures/{inheritance.html → posthtml/extend-template.html} +7 -7
  49. package/test/fixtures/posthtml/fetch.html +9 -0
  50. package/test/fixtures/posthtml/layout.html +11 -0
  51. package/test/fixtures/transformers/atimport-in-style.html +11 -0
  52. package/test/fixtures/transformers/base-url.html +101 -0
  53. package/test/fixtures/transformers/filters.html +87 -0
  54. package/test/fixtures/transformers/preserve-transform-css.html +25 -0
  55. package/test/fixtures/useConfig.html +9 -0
  56. package/test/stubs/components/component.html +5 -0
  57. package/test/stubs/data.json +14 -0
  58. package/test/stubs/layouts/basic.html +1 -0
  59. package/test/stubs/{layout.html → layouts/full.html} +0 -0
  60. package/test/stubs/{layout-basic.html → layouts/template.html} +5 -5
  61. package/test/stubs/post.css +6 -0
  62. package/test/stubs/tailwind/content-source.html +1 -0
  63. package/test/stubs/tailwind/tailwind.css +3 -0
  64. package/test/stubs/template.html +10 -10
  65. package/test/stubs/templates/1.html +1 -1
  66. package/test/stubs/templates/2.test +1 -0
  67. package/test/test-config.js +19 -19
  68. package/test/test-misc.js +8 -8
  69. package/test/test-postcss.js +8 -0
  70. package/test/test-posthtml.js +72 -0
  71. package/test/test-tailwindcss.js +117 -0
  72. package/test/test-todisk.js +142 -49
  73. package/test/test-tostring.js +148 -124
  74. package/test/test-transformers.js +510 -320
  75. package/xo.config.js +22 -19
  76. package/src/transformers/base-image-url.js +0 -9
  77. package/src/transformers/remove-unused-css.js +0 -20
  78. package/src/transformers/six-hex.js +0 -10
  79. package/src/transformers/transform.js +0 -24
  80. package/test/expected/transformers/base-image-url.html +0 -7
  81. package/test/fixtures/transformers/base-image-url.html +0 -7
  82. package/test/stubs/templates/2.html +0 -1
  83. package/test/stubs/templates/3.mzl +0 -1
  84. package/test/test-tailwind.js +0 -73
@@ -1,57 +1,63 @@
1
- const inline = require('./inline')
2
- const minify = require('./minify')
3
- const markdown = require('./markdown')
4
- const prettify = require('./prettify')
5
- const ensureSixHEX = require('./six-hex')
6
- const addURLParams = require('./url-params')
7
- const transformContents = require('./transform')
8
- const preventWidows = require('./prevent-widows')
9
- const replaceStrings = require('./replace-strings')
10
- const safeClassNames = require('./safe-class-names')
11
- const applyBaseImageUrl = require('./base-image-url')
12
- const removeUnusedCSS = require('./remove-unused-css')
13
- const removeAttributes = require('./remove-attributes')
14
- const attributeToStyle = require('./attribute-to-style')
15
- const removeInlineSizes = require('./remove-inline-sizes')
16
- const applyExtraAttributes = require('./extra-attributes')
17
- const removeInlineBgColor = require('./remove-inline-bgcolor')
18
-
19
- exports.process = async (html, config) => {
20
- html = await safeClassNames(html, config)
21
- html = await transformContents(html, config)
22
- html = await markdown(html, config)
23
- html = await preventWidows(html, config)
24
- html = await attributeToStyle(html, config)
25
- html = await inline(html, config)
26
- html = await removeUnusedCSS(html, config)
27
- html = await removeInlineSizes(html, config)
28
- html = await removeInlineBgColor(html, config)
29
- html = await removeAttributes(html, config)
30
- html = await applyExtraAttributes(html, config)
31
- html = await applyBaseImageUrl(html, config)
32
- html = await addURLParams(html, config)
33
- html = await ensureSixHEX(html, config)
34
- html = await prettify(html, config)
35
- html = await minify(html, config)
36
- html = await replaceStrings(html, config)
37
-
38
- return html
39
- }
40
-
41
- exports.inlineCSS = (html, config) => inline(html, config, true)
42
- exports.minify = (html, config) => minify(html, config, true)
43
- exports.markdown = (html, config) => markdown(html, config, true)
44
- exports.prettify = (html, config) => prettify(html, config, true)
45
- exports.ensureSixHEX = (html, config) => ensureSixHEX(html, config)
46
- exports.addURLParams = (html, config) => addURLParams(html, config, true)
47
- exports.transformContents = (html, config) => transformContents(html, config, true)
48
- exports.preventWidows = (html, config) => preventWidows(html, config, true)
49
- exports.replaceStrings = (html, config) => replaceStrings(html, config, true)
50
- exports.safeClassNames = (html, config) => safeClassNames(html, config, true)
51
- exports.applyBaseImageUrl = (html, config) => applyBaseImageUrl(html, config, true)
52
- exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config, true)
53
- exports.removeAttributes = (html, config) => removeAttributes(html, config, true)
54
- exports.removeInlineSizes = (html, config) => removeInlineSizes(html, config, true)
55
- exports.applyExtraAttributes = (html, config) => applyExtraAttributes(html, config, true)
56
- exports.removeInlineBgColor = (html, config) => removeInlineBgColor(html, config, true)
57
- exports.attributeToStyle = (html, config) => attributeToStyle(html, config, true)
1
+ const inline = require('./inlineCss')
2
+ const minify = require('./minify')
3
+ const filters = require('./filters')
4
+ const markdown = require('./markdown')
5
+ const prettify = require('./prettify')
6
+ const ensureSixHEX = require('./sixHex')
7
+ const applyBaseImageUrl = require('./baseUrl')
8
+ const addURLParams = require('./urlParameters')
9
+ const preventWidows = require('./preventWidows')
10
+ const replaceStrings = require('./replaceStrings')
11
+ const safeClassNames = require('./safeClassNames')
12
+ const removeUnusedCSS = require('./removeUnusedCss')
13
+ const removeAttributes = require('./removeAttributes')
14
+ const attributeToStyle = require('./attributeToStyle')
15
+ const removeInlineSizes = require('./removeInlineSizes')
16
+ const applyExtraAttributes = require('./extraAttributes')
17
+ const shorthandInlineCSS = require('./shorthandInlineCSS')
18
+ const removeInlinedClasses = require('./removeInlinedSelectors')
19
+ const removeInlineBgColor = require('./removeInlineBackgroundColor')
20
+
21
+ exports.process = async (html, config) => {
22
+ html = await safeClassNames(html, config)
23
+ html = await filters(html, config)
24
+ html = await markdown(html, config)
25
+ html = await preventWidows(html, config)
26
+ html = await attributeToStyle(html, config)
27
+ html = await inline(html, config)
28
+ html = await shorthandInlineCSS(html, config)
29
+ html = await removeInlinedClasses(html, config)
30
+ html = await removeUnusedCSS(html, config)
31
+ html = await removeInlineSizes(html, config)
32
+ html = await removeInlineBgColor(html, config)
33
+ html = await removeAttributes(html, config)
34
+ html = await applyExtraAttributes(html, config)
35
+ html = await applyBaseImageUrl(html, config)
36
+ html = await addURLParams(html, config)
37
+ html = await ensureSixHEX(html, config)
38
+ html = await prettify(html, config)
39
+ html = await minify(html, config)
40
+ html = await replaceStrings(html, config)
41
+
42
+ return html
43
+ }
44
+
45
+ exports.minify = (html, config) => minify(html, config, true)
46
+ exports.inlineCSS = (html, config) => inline(html, config, true)
47
+ exports.markdown = (html, config) => markdown(html, config, true)
48
+ exports.prettify = (html, config) => prettify(html, config, true)
49
+ exports.ensureSixHEX = (html, config) => ensureSixHEX(html, config)
50
+ exports.withFilters = (html, config) => filters(html, config, true)
51
+ exports.addURLParams = (html, config) => addURLParams(html, config, true)
52
+ exports.preventWidows = (html, config) => preventWidows(html, config, true)
53
+ exports.replaceStrings = (html, config) => replaceStrings(html, config, true)
54
+ exports.safeClassNames = (html, config) => safeClassNames(html, config, true)
55
+ exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config, true)
56
+ exports.removeAttributes = (html, config) => removeAttributes(html, config, true)
57
+ exports.attributeToStyle = (html, config) => attributeToStyle(html, config, true)
58
+ exports.removeInlineSizes = (html, config) => removeInlineSizes(html, config, true)
59
+ exports.applyBaseImageUrl = (html, config) => applyBaseImageUrl(html, config, true)
60
+ exports.removeInlinedClasses = (html, config) => removeInlinedClasses(html, config)
61
+ exports.shorthandInlineCSS = (html, config) => shorthandInlineCSS(html, config, true)
62
+ exports.removeInlineBgColor = (html, config) => removeInlineBgColor(html, config, true)
63
+ exports.applyExtraAttributes = (html, config) => applyExtraAttributes(html, config, true)
@@ -1,7 +1,5 @@
1
1
  const juice = require('juice')
2
- const posthtml = require('posthtml')
3
2
  const {get, isObject, isEmpty} = require('lodash')
4
- const mergeLonghand = require('posthtml-postcss-merge-longhand')
5
3
 
6
4
  module.exports = async (html, config = {}, direct = false) => {
7
5
  if (get(config, 'inlineCSS') === false) {
@@ -9,7 +7,7 @@ module.exports = async (html, config = {}, direct = false) => {
9
7
  }
10
8
 
11
9
  const options = direct ? config : get(config, 'inlineCSS', {})
12
- const removeStyleTags = get(options, 'removeStyleTags', true)
10
+ const removeStyleTags = get(options, 'removeStyleTags', false)
13
11
  const css = get(config, 'customCSS', false)
14
12
 
15
13
  if (get(config, 'inlineCSS') === true || !isEmpty(options)) {
@@ -32,17 +30,6 @@ module.exports = async (html, config = {}, direct = false) => {
32
30
 
33
31
  html = css ? juice.inlineContent(html, css, {removeStyleTags}) : juice(html, {removeStyleTags})
34
32
 
35
- const posthtmlOptions = get(config, 'build.posthtml.options', {})
36
- const mergeLonghandConfig = get(options, 'mergeLonghand', [])
37
-
38
- if (typeof mergeLonghandConfig === 'boolean' && mergeLonghandConfig) {
39
- html = await posthtml([mergeLonghand()]).process(html, posthtmlOptions).then(result => result.html)
40
- }
41
-
42
- if (isObject(mergeLonghandConfig) && !isEmpty(mergeLonghandConfig)) {
43
- html = await posthtml([mergeLonghand({tags: mergeLonghandConfig})]).process(html, posthtmlOptions).then(result => result.html)
44
- }
45
-
46
33
  return html
47
34
  }
48
35
 
@@ -1,5 +1,5 @@
1
- const {get, isEmpty} = require('lodash')
2
1
  const {crush} = require('html-crush')
2
+ const {get, isEmpty} = require('lodash')
3
3
 
4
4
  module.exports = async (html, config = {}, direct = false) => {
5
5
  if (get(config, 'minify') === false) {
@@ -1,20 +1,27 @@
1
- const {get, isEmpty} = require('lodash')
1
+ /* eslint-disable camelcase */
2
2
  const pretty = require('pretty')
3
+ const {get, merge, isEmpty, isObject} = require('lodash')
3
4
 
4
5
  module.exports = async (html, config = {}, direct = false) => {
5
- if (get(config, 'prettify') === false) {
6
- return html
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
7
11
  }
8
12
 
9
- config = direct ? config : get(config, 'prettify', {})
13
+ config = direct ? config : get(config, 'prettify')
10
14
 
11
- if (typeof config === 'boolean' && config) {
12
- return pretty(html)
15
+ // Don't prettify if not explicitly enabled in config
16
+ if (!config || (isObject(config) && isEmpty(config))) {
17
+ return html
13
18
  }
14
19
 
15
- if (!isEmpty(config)) {
16
- return pretty(html, config)
20
+ if (typeof config === 'boolean' && config) {
21
+ return pretty(html, defaultConfig)
17
22
  }
18
23
 
19
- return html
24
+ config = merge(defaultConfig, config)
25
+
26
+ return pretty(html, config)
20
27
  }
@@ -8,7 +8,7 @@ module.exports = async (html, config = {}, direct = false) => {
8
8
 
9
9
  attributes.push({name: 'style'}, {name: 'class'})
10
10
 
11
- // Allow ommiting `value` key when removing empty attributes
11
+ // Allow omitting `value` key when removing empty attributes
12
12
  attributes.forEach(attr => {
13
13
  attr.value = attr.value || ''
14
14
  })
@@ -1,5 +1,5 @@
1
- const {get, isEmpty} = require('lodash')
2
1
  const posthtml = require('posthtml')
2
+ const {get, isEmpty} = require('lodash')
3
3
  const parseAttrs = require('posthtml-attrs-parser')
4
4
 
5
5
  module.exports = async (html, config = {}, direct = false) => {
@@ -0,0 +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
+ 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
+ }
@@ -0,0 +1,40 @@
1
+ const {comb} = require('email-comb')
2
+ const {get, isEmpty} = require('lodash')
3
+
4
+ module.exports = async (html, config = {}, direct = false) => {
5
+ if (get(config, 'removeUnusedCSS') === false) {
6
+ return html
7
+ }
8
+
9
+ const options = direct ? config : get(config, 'removeUnusedCSS', {})
10
+
11
+ const safelist = [
12
+ '*body*', // Gmail
13
+ '.gmail*', // Gmail
14
+ '.apple*', // Apple Mail
15
+ '.ios*', // Mail on iOS
16
+ '.ox-*', // Open-Xchange
17
+ '.outlook*', // Outlook.com
18
+ '.ogs*', // Outlook.com
19
+ '.bloop_container', // Airmail
20
+ '.Singleton', // Apple Mail 10
21
+ '.unused', // Notes 8
22
+ '.moz-text-html', // Thunderbird
23
+ '.mail-detail-content', // Comcast, Libero webmail
24
+ '*edo*', // Edison (all)
25
+ '#*', // Freenet uses #msgBody
26
+ '.lang*' // Fenced code blocks
27
+ ]
28
+
29
+ if (typeof options === 'boolean' && options) {
30
+ return comb(html, {whitelist: safelist}).result
31
+ }
32
+
33
+ if (!isEmpty(options)) {
34
+ options.whitelist = [...get(options, 'whitelist', []), ...safelist]
35
+
36
+ return comb(html, options).result
37
+ }
38
+
39
+ return html
40
+ }
@@ -3,11 +3,17 @@ const posthtml = require('posthtml')
3
3
  const safeClassNames = require('posthtml-safe-class-names')
4
4
 
5
5
  module.exports = async (html, config = {}, direct = false) => {
6
- if (get(config, 'safeClassNames') === false) {
6
+ const option = get(config, 'safeClassNames')
7
+
8
+ if (option === false) {
7
9
  return html
8
10
  }
9
11
 
10
- if (config.env === 'local') {
12
+ /*
13
+ * Setting it to `true` in the config will run `safeClassNames`
14
+ * no matter the environment.
15
+ */
16
+ if (config.env === 'local' && !option) {
11
17
  return html
12
18
  }
13
19
 
@@ -0,0 +1,19 @@
1
+ const posthtml = require('posthtml')
2
+ const {get, isObject, isEmpty} = require('lodash')
3
+ const mergeLonghand = require('posthtml-postcss-merge-longhand')
4
+
5
+ module.exports = async (html, config, direct = false) => {
6
+ config = direct ? (isObject(config) ? config : true) : get(config, 'shorthandInlineCSS', [])
7
+
8
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
9
+
10
+ if (typeof config === 'boolean' && config) {
11
+ html = await posthtml([mergeLonghand()]).process(html, posthtmlOptions).then(result => result.html)
12
+ }
13
+
14
+ if (isObject(config) && !isEmpty(config)) {
15
+ html = await posthtml([mergeLonghand(config)]).process(html, posthtmlOptions).then(result => result.html)
16
+ }
17
+
18
+ return html
19
+ }
@@ -0,0 +1,33 @@
1
+ const {get} = require('lodash')
2
+ const posthtml = require('posthtml')
3
+ const parseAttrs = require('posthtml-attrs-parser')
4
+ const {conv} = require('color-shorthand-hex-to-six-digit')
5
+
6
+ module.exports = async (html, config = {}) => {
7
+ if (get(config, 'sixHex') === false) {
8
+ return html
9
+ }
10
+
11
+ const posthtmlOptions = get(config, 'build.posthtml.options', {})
12
+ return posthtml([sixHex()]).process(html, posthtmlOptions).then(result => result.html)
13
+ }
14
+
15
+ const sixHex = () => tree => {
16
+ const process = node => {
17
+ const attrs = parseAttrs(node.attrs)
18
+
19
+ const targets = ['bgcolor', 'color']
20
+
21
+ targets.forEach(attribute => {
22
+ if (attrs[attribute]) {
23
+ attrs[attribute] = conv(attrs[attribute])
24
+ }
25
+ })
26
+
27
+ node.attrs = attrs.compose()
28
+
29
+ return node
30
+ }
31
+
32
+ return tree.walk(process)
33
+ }
@@ -1,5 +1,3 @@
1
- const readline = require('readline')
2
-
3
1
  module.exports = {
4
2
  asyncForEach: async (array, callback) => {
5
3
  for (let index = 0; index < array.length; index++) {
@@ -14,10 +12,6 @@ module.exports = {
14
12
  throw new Error(`could not load ${module}`)
15
13
  }
16
14
  },
17
- clearConsole: () => {
18
- const blank = '\n'.repeat(process.stdout.rows)
19
- console.log(blank)
20
- readline.cursorTo(process.stdout, 0, 0)
21
- readline.clearScreenDown(process.stdout)
22
- }
15
+ // https://github.com/lukeed/console-clear
16
+ clearConsole: () => process.stdout.write('\x1B[H\x1B[2J')
23
17
  }
@@ -0,0 +1,13 @@
1
+ Variable from attribute: Example
2
+
3
+ Variable from locals attribute: bar
4
+
5
+
6
+ Variable from page: maizzle-ci
7
+
8
+ Variable from attribute: Nested component
9
+
10
+ Variable from locals attribute: bar (nested)
11
+
12
+
13
+ Variable from page (nested): maizzle-ci
@@ -1,2 +1,2 @@
1
- Parent
2
- Child in second.html
1
+ Parent
2
+ Child in second.html
@@ -0,0 +1,5 @@
1
+ Leanne Graham
2
+
3
+ Ervin Howell
4
+
5
+ Clementine Bauch
@@ -0,0 +1,3 @@
1
+ Environment: maizzle-ci
2
+
3
+ Front matter variable: Hello
@@ -0,0 +1,15 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <style>div {
5
+ margin-top: 1px;
6
+ margin-right: 2px;
7
+ margin-bottom: 3px;
8
+ margin-left: 4px;
9
+ }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <div>test</div>
14
+ </body>
15
+ </html>
@@ -0,0 +1,99 @@
1
+ <html>
2
+ <head>
3
+ <style>.test {
4
+ background-image: url('https://example.com/image.jpg');
5
+ background: url('https://example.com/image.jpg');
6
+ background-image: url('https://preserve.me/image.jpg');
7
+ background: url('https://preserve.me/image.jpg');
8
+ }
9
+
10
+ .test-2 {
11
+ background-image: url("https://example.com/image.jpg");
12
+ background: url("https://example.com/image.jpg");
13
+ background-image: url("https://preserve.me/image.jpg");
14
+ background: url("https://preserve.me/image.jpg");
15
+ }
16
+
17
+ .test-3 {
18
+ background-image: url(https://example.com/image.jpg);
19
+ background: url(https://example.com/image.jpg);
20
+ background-image: url(https://preserve.me/image.jpg);
21
+ background: url(https://preserve.me/image.jpg);
22
+ }</style>
23
+ </head>
24
+
25
+ <body>
26
+ <img src="https://example.com/test.jpg">
27
+ <img src="https://example.com/test.jpg">
28
+
29
+ <img src="https://example.com/image1.jpg" srcset="https://example.com/image1-HD.jpg 2x, https://example.com/image1-phone.jpg 100w">
30
+
31
+ <img src="https://example.com/image2.jpg" srcset="https://example.com/image2-HD.jpg 2x, https://example.com/image2-phone.jpg 100w">
32
+
33
+ <picture>
34
+ <source media="(max-width: 799px)" srcset="https://example.com/elva-480w-close-portrait.jpg">
35
+ <source media="(min-width: 800px)" srcset="https://example.com/elva-800w.jpg">
36
+ <img src="https://example.com/elva-800w.jpg" alt="...">
37
+ </picture>
38
+
39
+ <video width="250" poster="https://example.com/flower.jpg">
40
+ <source src="https://example.com/media/flower.webm" type="video/webm">
41
+ <source src="https://example.tv/media/flower.mp4" type="video/mp4">
42
+ <track default="" kind="captions" srclang="en" src="https://example.com/media/tracks/friday.vtt">
43
+ </video>
44
+
45
+ <audio src="https://example.com/media/sample.mp3">
46
+ Fallback content
47
+ </audio>
48
+
49
+ <embed type="video/webm" src="https://example.com/media/flower.mp4" width="250" height="200">
50
+
51
+ <iframe width="300" height="200" src="https://example.com/embed.html"></iframe>
52
+
53
+ <input type="image" src="https://example.com/image.jpg" alt="">
54
+
55
+ <script src="https://example.com/javascript.js"></script>
56
+
57
+ <div>
58
+ <!--[if mso]>
59
+ <v:image xmlns:v="urn:schemas-microsoft-com:vml" src="https://example.com/image.jpg" style="width:600px;height:400px;" />
60
+ <v:rect fill="false" stroke="false" style="position:absolute;width:600px;height:400px;">
61
+ <v:textbox inset="0,0,0,0"><div><![endif]-->
62
+ <div>test</div>
63
+ <!--[if mso]></div></v:textbox></v:rect><![endif]-->
64
+ </div>
65
+
66
+ <!--[if mso]>
67
+ <v:image src="https://example.com/image-2.jpg" xmlns:v="urn:schemas-microsoft-com:vml" style="width:600px;height:400px;" />
68
+ <![endif]-->
69
+
70
+ <!--[if mso]>
71
+ <v:image xmlns:v="urn:schemas-microsoft-com:vml" src="https://example.com/image-3.jpg" style="width:600px;height:400px;" />
72
+ <![endif]-->
73
+
74
+ <table>
75
+ <tr>
76
+ <td background="https://example.com/image.png" bgcolor="#7bceeb" width="120" height="92" valign="top">
77
+ <!--[if gte mso 9]>
78
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:120px;height:92px;">
79
+ <v:fill type="tile" src="https://example.com/image.png" color="#7bceeb" />
80
+ <v:textbox inset="0,0,0,0">
81
+ <![endif]-->
82
+ <div>test</div>
83
+ <!--[if gte mso 9]>
84
+ </v:textbox>
85
+ </v:rect>
86
+ <![endif]-->
87
+ </td>
88
+ </tr>
89
+ </table>
90
+
91
+ <!--[if mso]>
92
+ <v:fill type="tile" src="https://example.com/image.png" color="#7bceeb" />
93
+ <![endif]-->
94
+
95
+ <!--[if mso]>
96
+ <v:fill type="tile" src="https://example.com/image.png" color="#7bceeb" />
97
+ <![endif]-->
98
+ </body>
99
+ </html>