@newlogic-digital/core 0.9.12 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
package/modules/Emails.js CHANGED
@@ -35,10 +35,23 @@ export class Emails {
35
35
  hbsFiles = hbsFiles.replace("hbs", "{hbs,latte,tpl}")
36
36
  }
37
37
 
38
+ let outputDir = "/" + Config.paths.output.root;
39
+
40
+ if (Config.paths.output.root === Config.paths.output.assets) {
41
+ outputDir = ""
42
+ }
43
+
38
44
  const build = lazypipe().pipe(() => gulpif(twigFiles, twig({
39
45
  functions: new Templates().functions,
40
46
  filters: new Templates().filters,
41
- extensions: new Templates().tags
47
+ extensions: new Templates().tags,
48
+ context: {
49
+ config: Config,
50
+ lang: Config.lang,
51
+ outputPath: "/" + Config.paths.output.root,
52
+ inputPath: "/" + Config.paths.input.root,
53
+ resolvePath: Config.serve.mode === "dev" ? "" : outputDir,
54
+ }
42
55
  })))
43
56
  .pipe(() => gulpif(hbsFiles, Modules.hbs.module(`${root + Config.paths.input.emails}/**/*.hbs`, Modules.hbs.helpers(Object.assign(new Templates().filters, new Templates().functions)))))
44
57
  .pipe(() => gulpif("*.{hbs,twig}", rename({ extname: ".html" })))
@@ -13,6 +13,8 @@ import loadLanguages from 'prismjs/components/index.js'
13
13
  import NormalizeWhitespace from 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace.js'
14
14
  import {Config, Exists, Functions, Modules, root} from "./Core.js";
15
15
 
16
+ loadLanguages(['markup', 'css', 'javascript'])
17
+
16
18
  export class Templates {
17
19
  get functions() {
18
20
  return Object.assign(Config.templates.functions, {
@@ -239,8 +241,6 @@ export class Templates {
239
241
  type = type.replace(":mirror", "")
240
242
  }
241
243
 
242
- loadLanguages(['markup', 'css', 'javascript'])
243
-
244
244
  const Normalize = new NormalizeWhitespace({
245
245
  'remove-trailing': true,
246
246
  'remove-indent': true,
@@ -300,11 +300,11 @@ export class Templates {
300
300
  (Twig) => {
301
301
  Twig.exports.extendTag({
302
302
  type: "json",
303
- regex: /^json\s+(.+)$/,
303
+ regex: /^json\s+(.+)$|^json$/,
304
304
  next: ["endjson"],
305
305
  open: true,
306
306
  compile: function (token) {
307
- const expression = token.match[1];
307
+ const expression = token.match[1] ?? `'_null'`;
308
308
 
309
309
  token.stack = Reflect.apply(Twig.expression.compile, this, [{
310
310
  type: Twig.expression.type.expression,
@@ -318,17 +318,26 @@ export class Templates {
318
318
  let name = Reflect.apply(Twig.expression.parse, this, [token.stack, context]);
319
319
  let output = this.parse(token.output, context);
320
320
 
321
- return {
322
- chain: chain,
323
- output: JSON.stringify({
324
- [name]: minifier.minify(output, {
325
- collapseWhitespace: true,
326
- collapseInlineTagWhitespace: false,
327
- minifyCSS: true,
328
- minifyJS: true
321
+ const minify = minifier.minify(output, {
322
+ collapseWhitespace: true,
323
+ collapseInlineTagWhitespace: false,
324
+ minifyCSS: true,
325
+ minifyJS: true
326
+ })
327
+
328
+ if (name === '_null') {
329
+ return {
330
+ chain: chain,
331
+ output: JSON.stringify(minify)
332
+ };
333
+ } else {
334
+ return {
335
+ chain: chain,
336
+ output: JSON.stringify({
337
+ [name]: minify
329
338
  })
330
- })
331
- };
339
+ };
340
+ }
332
341
  }
333
342
  });
334
343
  Twig.exports.extendTag({
@@ -374,7 +383,8 @@ export class Templates {
374
383
  layout: {template: Config.templates.layout}
375
384
  }),
376
385
  namespaces: {
377
- 'src': Config.paths.input.root
386
+ 'src': Config.paths.input.root,
387
+ 'templates': Config.paths.input.templates
378
388
  },
379
389
  globals: root + Config.paths.input.main
380
390
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newlogic-digital/core",
3
3
  "type": "module",
4
- "version": "0.9.12",
4
+ "version": "0.9.15",
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",
@@ -13,15 +13,15 @@
13
13
  "tailwind": "rollup modules/tailwind/index.js --file modules/tailwind/index.cjs --format cjs"
14
14
  },
15
15
  "dependencies": {
16
- "@babel/core": "^7.16.12",
17
- "@babel/preset-env": "^7.16.11",
18
- "@rollup/plugin-babel": "^5.3.0",
19
- "@rollup/plugin-commonjs": "^21.0.1",
20
- "@rollup/plugin-node-resolve": "^13.1.3",
21
- "@rollup/plugin-replace": "^3.0.1",
16
+ "@babel/core": "^7.17.12",
17
+ "@babel/preset-env": "^7.17.12",
18
+ "@rollup/plugin-babel": "^5.3.1",
19
+ "@rollup/plugin-commonjs": "^22.0.0",
20
+ "@rollup/plugin-node-resolve": "^13.3.0",
21
+ "@rollup/plugin-replace": "^4.0.0",
22
22
  "adm-zip": "^0.5.9",
23
- "clean-css": "^5.2.2",
24
- "fs-extra": "^10.0.0",
23
+ "clean-css": "^5.3.0",
24
+ "fs-extra": "^10.1.0",
25
25
  "plugin-error": "^1.0.1",
26
26
  "through2": "^4.0.2",
27
27
  "twig": "^1.15.4",
@@ -40,23 +40,23 @@
40
40
  "lazypipe": "^1.0.2",
41
41
  "lodash": "^4.17.21",
42
42
  "postcss-custom-media": "^8.0.0",
43
- "postcss-custom-properties": "^12.1.4",
43
+ "postcss-custom-properties": "^12.1.7",
44
44
  "postcss-custom-selectors": "^6.0.0",
45
- "postcss-import": "^14.0.2",
46
- "postcss-nesting": "^10.1.2",
47
- "rollup": "^2.66.1",
45
+ "postcss-import": "^14.1.0",
46
+ "postcss-nesting": "^10.1.6",
47
+ "rollup": "^2.73.0",
48
48
  "rollup-plugin-import-map": "^2.2.2",
49
49
  "rollup-plugin-terser": "^7.0.2",
50
- "vite": "~2.7.13",
51
- "prismjs": "^1.26.0"
50
+ "vite": "~2.9.9",
51
+ "prismjs": "^1.28.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "autoprefixer": "^10.4.2",
55
- "postcss": "^8.4.5",
56
- "tailwindcss": "^3.0.18"
54
+ "autoprefixer": "^10.4.7",
55
+ "postcss": "^8.4.13",
56
+ "tailwindcss": "^3.0.24"
57
57
  },
58
58
  "devDependencies": {
59
- "vitepress": "^0.21.6"
59
+ "vitepress": "^0.22.4"
60
60
  },
61
61
  "files": [
62
62
  "index.js",