@fractality/nunjucks 2.2.0 → 2.2.3
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/CHANGELOG.md +12 -0
- package/README.md +5 -5
- package/package.json +11 -8
- package/src/extensions/context.js +2 -2
- package/src/extensions/index.js +4 -4
- package/src/extensions/render.js +2 -2
- package/src/extensions/view.js +2 -2
- package/src/filters/index.js +2 -2
- package/src/filters/path.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 2.2.3 (2024-09-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @fractality/nunjucks
|
|
9
|
+
|
|
10
|
+
## 2.2.2 (2024-09-20)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @fractality/nunjucks
|
|
13
|
+
|
|
14
|
+
## 2.2.1 (2024-09-20)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @fractality/nunjucks
|
|
17
|
+
|
|
6
18
|
# 2.2.0 (2024-09-20)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @fractality/nunjucks
|
|
2
2
|
|
|
3
|
-
[Nunjucks](http://mozilla.github.io/nunjucks/) template engine adapter for [
|
|
3
|
+
[Nunjucks](http://mozilla.github.io/nunjucks/) template engine adapter for [Fractality](http://github.com/fractality/fractality).
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@fractality/nunjucks)
|
|
6
6
|
|
|
@@ -19,8 +19,8 @@ npm i @fractality/nunjucks --save
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
21
|
```javascript
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
fractality.components.engine('@fractality/nunjucks'); // register the Nunjucks adapter for your components
|
|
23
|
+
fractality.components.set('ext', '.njk'); // look for files with a .njk file extension
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Customisation
|
|
@@ -44,7 +44,7 @@ const nunj = nunjucksAdapter({
|
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
fractality.components.engine(nunj); /* set as the default template engine for components */
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
For example, to register the 'shorten' filter example from the [Nujucks docs](https://mozilla.github.io/nunjucks/api.html#custom-filters):
|
|
@@ -93,7 +93,7 @@ In this example the file `foo.html` would be searched for in the `path/to/files`
|
|
|
93
93
|
|
|
94
94
|
## Extensions
|
|
95
95
|
|
|
96
|
-
The following Nunjucks extensions come **automatically pre-installed**. These are often useful when building or documenting
|
|
96
|
+
The following Nunjucks extensions come **automatically pre-installed**. These are often useful when building or documenting Fractality-based component libraries.
|
|
97
97
|
|
|
98
98
|
If you **do not wish** to include these extensions, set `pristine: true` when configuring your Nunjucks adapter instance.
|
|
99
99
|
|
package/package.json
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fractality/nunjucks",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Nunjucks template adapter for
|
|
5
|
+
"description": "Nunjucks template adapter for Fractalility.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/
|
|
9
|
+
"url": "https://github.com/sitepark/fractality.git",
|
|
10
10
|
"directory": "packages/nunjucks"
|
|
11
11
|
},
|
|
12
12
|
"author": "Mark Perkins <mark@clearleft.com> (http://clearleft.com/)",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/sitepark/fractality/issues"
|
|
16
16
|
},
|
|
17
|
-
"homepage": "https://github.com/
|
|
17
|
+
"homepage": "https://github.com/sitepark/fractality/tree/main/packages/nunjucks",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@fractality/fractality": ">= 1.
|
|
19
|
+
"@fractality/fractality": ">= 1.5 < 2"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fractality/core": "
|
|
22
|
+
"@fractality/core": "0.5.3",
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"nunjucks": "^3.2.4"
|
|
25
25
|
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@fractality/fractality": "1.6.3"
|
|
28
|
+
},
|
|
26
29
|
"publishConfig": {
|
|
27
30
|
"access": "public"
|
|
28
31
|
},
|
|
29
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "731216ddfcec69395c3e3e6f9b85cde374e6687e"
|
|
30
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
export default function (
|
|
3
|
+
export default function (fractality) {
|
|
4
4
|
function ContextExtension() {
|
|
5
5
|
this.tags = ['context'];
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ export default function (fractal) {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
this.run = function () {
|
|
15
|
-
const source =
|
|
15
|
+
const source = fractality.components;
|
|
16
16
|
const args = Array.from(arguments);
|
|
17
17
|
const callback = args.pop();
|
|
18
18
|
args.shift();
|
package/src/extensions/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import _render from './render.js';
|
|
|
4
4
|
import _view from './view.js';
|
|
5
5
|
import _context from './context.js';
|
|
6
6
|
|
|
7
|
-
export default function (
|
|
7
|
+
export default function (fractality) {
|
|
8
8
|
return {
|
|
9
|
-
render: _render(
|
|
10
|
-
view: _view(
|
|
11
|
-
context: _context(
|
|
9
|
+
render: _render(fractality),
|
|
10
|
+
view: _view(fractality),
|
|
11
|
+
context: _context(fractality),
|
|
12
12
|
};
|
|
13
13
|
}
|
package/src/extensions/render.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import nunjucks from 'nunjucks';
|
|
4
4
|
import { utils } from '@fractality/core';
|
|
5
5
|
|
|
6
|
-
export default function (
|
|
6
|
+
export default function (fractality) {
|
|
7
7
|
function RenderExtension() {
|
|
8
8
|
this.tags = ['render'];
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ export default function (fractal) {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
this.run = function () {
|
|
18
|
-
const source =
|
|
18
|
+
const source = fractality.components;
|
|
19
19
|
const args = Array.from(arguments);
|
|
20
20
|
const rootContext = args[0].ctx;
|
|
21
21
|
const callback = args.pop();
|
package/src/extensions/view.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import nunjucks from 'nunjucks';
|
|
4
4
|
|
|
5
|
-
export default function (
|
|
5
|
+
export default function (fractality) {
|
|
6
6
|
function ViewExtension() {
|
|
7
7
|
this.tags = ['view'];
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ export default function (fractal) {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
this.run = function () {
|
|
17
|
-
const source =
|
|
17
|
+
const source = fractality.components;
|
|
18
18
|
const args = Array.from(arguments);
|
|
19
19
|
const callback = args.pop();
|
|
20
20
|
args.shift();
|
package/src/filters/index.js
CHANGED
package/src/filters/path.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import { utils } from '@fractality/core';
|
|
5
5
|
|
|
6
|
-
export default function (
|
|
6
|
+
export default function (fractality) {
|
|
7
7
|
return function (path) {
|
|
8
8
|
let env = this.lookup('_env');
|
|
9
9
|
let request = env.request || this.lookup('_request') || this.ctx.request;
|
|
10
10
|
|
|
11
11
|
return !env || env.server
|
|
12
12
|
? path
|
|
13
|
-
: utils.relUrlPath(path, _.get(request, 'path', '/'),
|
|
13
|
+
: utils.relUrlPath(path, _.get(request, 'path', '/'), fractality.web.get('builder.urls'));
|
|
14
14
|
};
|
|
15
15
|
}
|