@maizzle/framework 4.4.0-beta.3 → 4.4.0-beta.5
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
|
@@ -67,6 +67,17 @@ module.exports = async (env, spinner, config) => {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// Create a pipe-delimited list of allowed extensions
|
|
71
|
+
// We only compile these, the rest are copied as-is
|
|
72
|
+
const extensions = Array.isArray(templateConfig.filetypes)
|
|
73
|
+
? templateConfig.filetypes.join('|')
|
|
74
|
+
: templateConfig.filetypes || get(templateConfig, 'filetypes', 'html')
|
|
75
|
+
|
|
76
|
+
// List of files that won't be copied to the output directory
|
|
77
|
+
const omitted = Array.isArray(templateConfig.omit) ?
|
|
78
|
+
templateConfig.omit :
|
|
79
|
+
[get(templateConfig, 'omit', '')]
|
|
80
|
+
|
|
70
81
|
// Parse each template source
|
|
71
82
|
await asyncForEach(templateSource, async source => {
|
|
72
83
|
/**
|
|
@@ -77,13 +88,22 @@ module.exports = async (env, spinner, config) => {
|
|
|
77
88
|
const out = fs.lstatSync(source).isFile() ? `${outputDir}/${path.basename(source)}` : outputDir
|
|
78
89
|
|
|
79
90
|
await fs
|
|
80
|
-
.copy(source, out
|
|
91
|
+
.copy(source, out, {filter: file => {
|
|
92
|
+
// Do not copy omitted files
|
|
93
|
+
return !omitted
|
|
94
|
+
.filter(Boolean)
|
|
95
|
+
.some(omit => path.normalize(file).includes(path.normalize(omit)))
|
|
96
|
+
}})
|
|
81
97
|
.then(async () => {
|
|
82
|
-
const
|
|
83
|
-
? templateConfig.filetypes.join('|')
|
|
84
|
-
: templateConfig.filetypes || get(templateConfig, 'filetypes', 'html')
|
|
98
|
+
const allSourceFiles = await glob(`${outputDir}/**/*.+(${extensions})`)
|
|
85
99
|
|
|
86
|
-
const
|
|
100
|
+
const skipped = Array.isArray(templateConfig.skip) ?
|
|
101
|
+
templateConfig.skip :
|
|
102
|
+
[get(templateConfig, 'skip', '')]
|
|
103
|
+
|
|
104
|
+
const templates = allSourceFiles.filter(template => {
|
|
105
|
+
return !skipped.includes(template.replace(`${outputDir}/`, ''))
|
|
106
|
+
})
|
|
87
107
|
|
|
88
108
|
if (templates.length === 0) {
|
|
89
109
|
spinner.warn(`Error: no files with the .${extensions} extension found in ${templateConfig.source}`)
|
|
@@ -9,7 +9,9 @@ module.exports = {
|
|
|
9
9
|
return postcss([
|
|
10
10
|
postcssImport(),
|
|
11
11
|
postcssNested(),
|
|
12
|
-
maizzleConfig
|
|
12
|
+
get(maizzleConfig, 'shorthandCSS', get(maizzleConfig, 'shorthandInlineCSS')) === true ?
|
|
13
|
+
mergeLonghand() :
|
|
14
|
+
() => {},
|
|
13
15
|
...get(maizzleConfig, 'build.postcss.plugins', [])
|
|
14
16
|
])
|
|
15
17
|
.process(css, {from: undefined})
|
|
@@ -99,7 +99,9 @@ module.exports = {
|
|
|
99
99
|
const toProcess = [
|
|
100
100
|
postcssNested(),
|
|
101
101
|
tailwindcss(config),
|
|
102
|
-
maizzleConfig
|
|
102
|
+
get(maizzleConfig, 'shorthandCSS', get(maizzleConfig, 'shorthandInlineCSS')) === true ?
|
|
103
|
+
mergeLonghand() :
|
|
104
|
+
() => {},
|
|
103
105
|
...get(maizzleConfig, 'build.postcss.plugins', [])
|
|
104
106
|
]
|
|
105
107
|
|
|
@@ -5,7 +5,7 @@ const {get, merge, isObject, isEmpty} = require('lodash')
|
|
|
5
5
|
const defaultConfig = require('../generators/posthtml/defaultConfig')
|
|
6
6
|
|
|
7
7
|
module.exports = async (html, config = {}, direct = false) => {
|
|
8
|
-
const url = direct ? config : get(config, 'baseURL')
|
|
8
|
+
const url = direct ? config : get(config, 'baseURL', get(config, 'baseUrl'))
|
|
9
9
|
const posthtmlOptions = merge(defaultConfig, get(config, 'build.posthtml.options', {}))
|
|
10
10
|
|
|
11
11
|
// Handle `baseUrl` as a string
|
|
@@ -19,9 +19,9 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
19
19
|
.then(result => result.html)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
// Handle `
|
|
22
|
+
// Handle `baseURL` as an object
|
|
23
23
|
if (isObject(url) && !isEmpty(url)) {
|
|
24
|
-
html = rewriteVMLs(html, url
|
|
24
|
+
html = rewriteVMLs(html, get(url, 'url', ''))
|
|
25
25
|
|
|
26
26
|
return posthtml([baseUrl(url)]).process(html, posthtmlOptions).then(result => result.html)
|
|
27
27
|
}
|
|
@@ -26,8 +26,8 @@ exports.process = async (html, config) => {
|
|
|
26
26
|
html = await preventWidows(html, config)
|
|
27
27
|
html = await attributeToStyle(html, config)
|
|
28
28
|
html = await inline(html, config)
|
|
29
|
-
html = await shorthandInlineCSS(html, config)
|
|
30
29
|
html = await removeUnusedCSS(html, config)
|
|
30
|
+
html = await shorthandInlineCSS(html, config)
|
|
31
31
|
html = await removeInlineSizes(html, config)
|
|
32
32
|
html = await removeInlineBgColor(html, config)
|
|
33
33
|
html = await removeAttributes(html, config)
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
const posthtml = require('posthtml')
|
|
2
2
|
const {get, merge, isObject, isEmpty} = require('lodash')
|
|
3
|
-
const
|
|
3
|
+
const mergeInlineLonghand = require('posthtml-postcss-merge-longhand')
|
|
4
4
|
const defaultConfig = require('../generators/posthtml/defaultConfig')
|
|
5
5
|
|
|
6
6
|
module.exports = async (html, config, direct = false) => {
|
|
7
|
-
config = direct ?
|
|
7
|
+
config = direct ?
|
|
8
|
+
(isObject(config) ? config : true) :
|
|
9
|
+
get(config, 'shorthandCSS', get(config, 'shorthandInlineCSS', []))
|
|
8
10
|
|
|
9
11
|
const posthtmlOptions = merge(defaultConfig, get(config, 'build.posthtml.options', {}))
|
|
10
12
|
|
|
11
13
|
if (typeof config === 'boolean' && config) {
|
|
12
|
-
html = await posthtml([
|
|
14
|
+
html = await posthtml([mergeInlineLonghand()])
|
|
15
|
+
.process(html, posthtmlOptions)
|
|
16
|
+
.then(result => result.html)
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
if (isObject(config) && !isEmpty(config)) {
|
|
16
|
-
html = await posthtml([
|
|
20
|
+
html = await posthtml([mergeInlineLonghand(config)])
|
|
21
|
+
.process(html, posthtmlOptions)
|
|
22
|
+
.then(result => result.html)
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
return html
|