@maizzle/framework 4.0.3 → 4.1.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.
package/package.json
CHANGED
|
@@ -26,8 +26,8 @@ exports.process = async (html, config) => {
|
|
|
26
26
|
html = await attributeToStyle(html, config)
|
|
27
27
|
html = await inline(html, config)
|
|
28
28
|
html = await shorthandInlineCSS(html, config)
|
|
29
|
-
html = await removeInlinedClasses(html, config)
|
|
30
29
|
html = await removeUnusedCSS(html, config)
|
|
30
|
+
html = await removeInlinedClasses(html, config)
|
|
31
31
|
html = await removeInlineSizes(html, config)
|
|
32
32
|
html = await removeInlineBgColor(html, config)
|
|
33
33
|
html = await removeAttributes(html, config)
|
|
@@ -48,7 +48,7 @@ const plugin = () => tree => {
|
|
|
48
48
|
* like `margin: 0 0 0 16px` (transformed with mergeLonghand when inlining).
|
|
49
49
|
*/
|
|
50
50
|
Object.keys(styleAttr).forEach(key => {
|
|
51
|
-
if (prop.includes(key)) {
|
|
51
|
+
if (prop && prop.includes(key)) {
|
|
52
52
|
rule.remove()
|
|
53
53
|
remove(classAttr, s => selector.includes(s))
|
|
54
54
|
}
|
|
@@ -7,10 +7,12 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
7
7
|
|
|
8
8
|
if (!isEmpty(urlParameters)) {
|
|
9
9
|
const {_options, ...parameters} = urlParameters
|
|
10
|
-
const
|
|
10
|
+
const tags = _options.tags ?? ['a']
|
|
11
|
+
const strict = _options.strict ?? true
|
|
12
|
+
const qs = _options.qs ?? {encode: false}
|
|
11
13
|
const posthtmlOptions = get(config, 'build.posthtml.options', {})
|
|
12
14
|
|
|
13
|
-
return posthtml([urlParams({parameters, tags, qs})]).process(html, posthtmlOptions).then(result => result.html)
|
|
15
|
+
return posthtml([urlParams({parameters, tags, qs, strict})]).process(html, posthtmlOptions).then(result => result.html)
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
return html
|
package/test/test-todisk.js
CHANGED
|
@@ -509,3 +509,34 @@ test('throws if templates path is invalid (function)', async t => {
|
|
|
509
509
|
})
|
|
510
510
|
}, {instanceOf: TypeError})
|
|
511
511
|
})
|
|
512
|
+
|
|
513
|
+
test('sets config.build.current.path', async t => {
|
|
514
|
+
await Maizzle.build('maizzle-ci', {
|
|
515
|
+
build: {
|
|
516
|
+
fail: 'silent',
|
|
517
|
+
templates: {
|
|
518
|
+
source: 'test/stubs/templates',
|
|
519
|
+
destination: {
|
|
520
|
+
path: t.context.folder
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
events: {
|
|
525
|
+
beforeRender(html, config) {
|
|
526
|
+
t.context.current = config.build.current
|
|
527
|
+
|
|
528
|
+
return html
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
})
|
|
532
|
+
|
|
533
|
+
t.deepEqual(t.context.current, {
|
|
534
|
+
path: {
|
|
535
|
+
root: '',
|
|
536
|
+
dir: t.context.folder,
|
|
537
|
+
base: '1.html',
|
|
538
|
+
ext: '.html',
|
|
539
|
+
name: '1'
|
|
540
|
+
}
|
|
541
|
+
})
|
|
542
|
+
})
|
|
@@ -323,9 +323,21 @@ test('filters (postcss)', async t => {
|
|
|
323
323
|
})
|
|
324
324
|
|
|
325
325
|
test('url parameters', async t => {
|
|
326
|
-
const html = await Maizzle.addURLParams(
|
|
326
|
+
const html = await Maizzle.addURLParams(
|
|
327
|
+
`<a href="example.com">test</a>
|
|
328
|
+
<link href="https://foo.bar">`,
|
|
329
|
+
{
|
|
330
|
+
_options: {
|
|
331
|
+
tags: ['a[href*="example"]'],
|
|
332
|
+
strict: false
|
|
333
|
+
},
|
|
334
|
+
bar: 'baz',
|
|
335
|
+
qix: 'qux'
|
|
336
|
+
}
|
|
337
|
+
)
|
|
327
338
|
|
|
328
|
-
t.is(html,
|
|
339
|
+
t.is(html, `<a href="example.com?bar=baz&qix=qux">test</a>
|
|
340
|
+
<link href="https://foo.bar">`)
|
|
329
341
|
})
|
|
330
342
|
|
|
331
343
|
test('attribute to style', async t => {
|
|
@@ -383,7 +395,6 @@ test('remove inlined selectors', async t => {
|
|
|
383
395
|
border: 0;
|
|
384
396
|
vertical-align: middle
|
|
385
397
|
}
|
|
386
|
-
|
|
387
398
|
.hover-text-blue:hover {
|
|
388
399
|
color: #00a8ff;
|
|
389
400
|
}
|
|
@@ -400,6 +411,15 @@ test('remove inlined selectors', async t => {
|
|
|
400
411
|
|
|
401
412
|
#keepId {float:none}
|
|
402
413
|
|
|
414
|
+
.foo-class {
|
|
415
|
+
/* COMMENT */
|
|
416
|
+
color: red;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.ignore {
|
|
420
|
+
display: inline-block;
|
|
421
|
+
}
|
|
422
|
+
|
|
403
423
|
@media (max-width: 600px) {
|
|
404
424
|
.ignore {color: blue}
|
|
405
425
|
}
|
|
@@ -409,7 +429,7 @@ test('remove inlined selectors', async t => {
|
|
|
409
429
|
</style>
|
|
410
430
|
</head>
|
|
411
431
|
<body>
|
|
412
|
-
<div id="keepId" class="remove keep ignore" style="color: red; display: inline">
|
|
432
|
+
<div id="keepId" class="remove keep ignore foo-class" style="color: red; display: inline">
|
|
413
433
|
<h1 class="m-0 mb-4 mt-0 hover-text-blue" style="margin: 0 0 16px;">Title</h1>
|
|
414
434
|
<img src="https://example.com/image.jpg" style="border: 0; vertical-align: middle">
|
|
415
435
|
<div id="keepId" class="remove keep ignore" style="color: red; display: inline">text</div>
|
|
@@ -429,6 +449,11 @@ test('remove inlined selectors', async t => {
|
|
|
429
449
|
|
|
430
450
|
#keepId {float:none}
|
|
431
451
|
|
|
452
|
+
.foo-class {
|
|
453
|
+
/* COMMENT */
|
|
454
|
+
color: red;
|
|
455
|
+
}
|
|
456
|
+
|
|
432
457
|
@media (max-width: 600px) {
|
|
433
458
|
.ignore {color: blue}
|
|
434
459
|
}
|
|
@@ -438,10 +463,10 @@ test('remove inlined selectors', async t => {
|
|
|
438
463
|
</style>
|
|
439
464
|
</head>
|
|
440
465
|
<body>
|
|
441
|
-
<div id="keepId" class="keep
|
|
466
|
+
<div id="keepId" class="keep foo-class" style="color: red; display: inline">
|
|
442
467
|
<h1 class="hover-text-blue" style="margin: 0 0 16px">Title</h1>
|
|
443
468
|
<img src="https://example.com/image.jpg" style="border: 0; vertical-align: middle">
|
|
444
|
-
<div id="keepId" class="keep
|
|
469
|
+
<div id="keepId" class="keep" style="color: red; display: inline">text</div>
|
|
445
470
|
</div>
|
|
446
471
|
</body>
|
|
447
472
|
</html>`
|