@newlogic-digital/core 1.0.6 → 1.0.8
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/index.js +38 -2
- package/package.json +2 -2
package/index.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import tailwind from '@vituum/tailwind'
|
2
1
|
import posthtml from '@vituum/posthtml'
|
3
2
|
import juice from '@vituum/juice'
|
4
3
|
import twig from '@vituum/twig'
|
@@ -6,9 +5,19 @@ import latte from '@vituum/latte'
|
|
6
5
|
import lodash from 'lodash'
|
7
6
|
import minifier from 'html-minifier-terser'
|
8
7
|
import fs from 'fs'
|
8
|
+
import fse from 'fs-extra'
|
9
9
|
import { dirname, resolve } from 'path'
|
10
10
|
import postHtml from 'posthtml'
|
11
11
|
import highlight from './prism.js'
|
12
|
+
import tailwindcss from 'tailwindcss'
|
13
|
+
import tailwindcssNesting from 'tailwindcss/nesting/index.js'
|
14
|
+
import postcssImport from 'postcss-import'
|
15
|
+
import postcssNesting from 'postcss-nesting'
|
16
|
+
import postcssCustomMedia from 'postcss-custom-media'
|
17
|
+
import postcssCustomSelectors from 'postcss-custom-selectors'
|
18
|
+
import autoprefixer from 'autoprefixer'
|
19
|
+
import chalk from 'chalk'
|
20
|
+
import FastGlob from 'fast-glob'
|
12
21
|
|
13
22
|
const posthtmlPrism = {
|
14
23
|
name: '@vituum/vite-plugin-posthtml-prism',
|
@@ -76,6 +85,10 @@ const parseMinifyHtml = async (input, name) => {
|
|
76
85
|
|
77
86
|
const defaultConfig = {
|
78
87
|
format: 'twig',
|
88
|
+
emails: {
|
89
|
+
outputDir: resolve(process.cwd(), 'public/emails'),
|
90
|
+
prodDir: resolve(process.cwd(), 'app/Templates/Emails')
|
91
|
+
},
|
79
92
|
posthtml: {},
|
80
93
|
juice: {},
|
81
94
|
tailwind: {},
|
@@ -250,7 +263,23 @@ const integration = (userConfig = {}) => {
|
|
250
263
|
|
251
264
|
return {
|
252
265
|
config: {
|
253
|
-
integrations: [posthtml(userConfig.posthtml), juice(userConfig.juice),
|
266
|
+
integrations: [posthtml(userConfig.posthtml), juice(userConfig.juice), twig(userConfig.twig), latte(userConfig.latte), {
|
267
|
+
task: {
|
268
|
+
name: 'emails',
|
269
|
+
action: async () => {
|
270
|
+
const emails = FastGlob.sync(`${resolve(process.cwd(), userConfig.emails.outputDir)}/**`).filter(entry => entry.endsWith('prod.html'))
|
271
|
+
const emailsProd = emails.map(path => {
|
272
|
+
return path.replace(resolve(process.cwd(), userConfig.emails.outputDir), resolve(process.cwd(), userConfig.emails.prodDir)).replace('.prod.html', '.latte')
|
273
|
+
})
|
274
|
+
|
275
|
+
await Promise.all(emails.map((file, i) =>
|
276
|
+
fse.move(file, emailsProd[i])
|
277
|
+
))
|
278
|
+
|
279
|
+
console.info(`${chalk.cyan(`newlogic-core`)} ${chalk.green('all email files moved')}`)
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}],
|
254
283
|
plugins: [posthtmlPrism],
|
255
284
|
server: {
|
256
285
|
open: true,
|
@@ -266,6 +295,13 @@ const integration = (userConfig = {}) => {
|
|
266
295
|
vite: {
|
267
296
|
server: {
|
268
297
|
origin: fs.existsSync(resolve(process.cwd(), 'app/settings.php')) ? (fs.readFileSync(resolve(process.cwd(), 'app/settings.php')).toString().match(/VITE_URL = '(.+)';/) || [null, null])[1] : null
|
298
|
+
},
|
299
|
+
css: {
|
300
|
+
postcss: {
|
301
|
+
plugins: [postcssImport, tailwindcssNesting(postcssNesting({
|
302
|
+
noIsPseudoSelector: true
|
303
|
+
})), postcssCustomMedia, postcssCustomSelectors, tailwindcss(userConfig.tailwind), autoprefixer]
|
304
|
+
}
|
269
305
|
}
|
270
306
|
}
|
271
307
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@newlogic-digital/core",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.8",
|
5
5
|
"main": "index.js",
|
6
6
|
"author": "New Logic Studio s.r.o.",
|
7
7
|
"description": "Set of tools that can be used to create modern web applications",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"prismjs": "^1.29.0",
|
20
20
|
"html-minifier-terser": "^7.0.0",
|
21
21
|
"lodash": "^4.17.21",
|
22
|
-
"vituum": "^0.0.
|
22
|
+
"vituum": "^0.0.32"
|
23
23
|
},
|
24
24
|
"files": [
|
25
25
|
"latte",
|