@newlogic-digital/core 0.9.13 → 0.9.14

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.
@@ -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({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newlogic-digital/core",
3
3
  "type": "module",
4
- "version": "0.9.13",
4
+ "version": "0.9.14",
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",