@newlogic-digital/core 0.9.14 → 1.0.0-beta.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/README.md +15 -45
- package/index.js +262 -43
- package/package.json +13 -57
- package/LICENSE +0 -674
- package/modules/Core.js +0 -626
- package/modules/Emails.js +0 -110
- package/modules/Icons.js +0 -140
- package/modules/Scripts.js +0 -321
- package/modules/Serve.js +0 -124
- package/modules/Styles.js +0 -298
- package/modules/Templates.js +0 -477
- package/modules/Utils.js +0 -299
- package/modules/Watch.js +0 -75
- package/modules/tailwind/index.cjs +0 -84
- package/modules/tailwind/index.js +0 -75
- package/packages/gulp-clean-css/LICENSE +0 -20
- package/packages/gulp-clean-css/README.md +0 -79
- package/packages/gulp-clean-css/index.js +0 -66
- package/packages/gulp-clean-css/package.json +0 -68
- package/packages/gulp-twig2html/CHANGELOG.md +0 -77
- package/packages/gulp-twig2html/LICENSE +0 -22
- package/packages/gulp-twig2html/README.md +0 -112
- package/packages/gulp-twig2html/index.js +0 -30
- package/packages/gulp-twig2html/package.json +0 -47
- package/packages/postcss-inset/CHANGELOG.md +0 -5
- package/packages/postcss-inset/LICENSE.md +0 -106
- package/packages/postcss-inset/README.md +0 -121
- package/packages/postcss-inset/index.cjs.js +0 -49
- package/packages/postcss-inset/index.es.mjs +0 -47
- package/packages/postcss-inset/index.js +0 -47
- package/packages/postcss-inset/package.json +0 -58
- package/packages/twig-renderer/CHANGELOG.md +0 -66
- package/packages/twig-renderer/LICENSE +0 -22
- package/packages/twig-renderer/README.md +0 -93
- package/packages/twig-renderer/package.json +0 -49
- package/packages/twig-renderer/twig-renderer.js +0 -90
@@ -1,49 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
const creator = () => {
|
4
|
-
// side properties
|
5
|
-
const properties = ['top', 'right', 'bottom', 'left'];
|
6
|
-
|
7
|
-
return {
|
8
|
-
postcssPlugin: 'postcss-inset',
|
9
|
-
Declaration: {
|
10
|
-
'inset': (decl, { list }) => {
|
11
|
-
// space-separated side values (top, right, bottom, left)
|
12
|
-
const values = list.space(decl.value);
|
13
|
-
|
14
|
-
// conditionally add a right value
|
15
|
-
if (values.length === 1) {
|
16
|
-
values.push(values[0]);
|
17
|
-
}
|
18
|
-
|
19
|
-
// conditionally add a bottom value
|
20
|
-
if (values.length === 2) {
|
21
|
-
values.push(values[0]);
|
22
|
-
}
|
23
|
-
|
24
|
-
// conditionally add a left value
|
25
|
-
if (values.length === 3) {
|
26
|
-
values.push(values[1]);
|
27
|
-
}
|
28
|
-
|
29
|
-
// only transform up to 4 side values
|
30
|
-
if (values.length === 4) {
|
31
|
-
// for each side property
|
32
|
-
properties.forEach((property, index) => {
|
33
|
-
// create a new declaration for the side
|
34
|
-
decl.cloneBefore({
|
35
|
-
prop: property,
|
36
|
-
value: values[index]
|
37
|
-
});
|
38
|
-
});
|
39
|
-
}
|
40
|
-
|
41
|
-
decl.remove();
|
42
|
-
},
|
43
|
-
}
|
44
|
-
}
|
45
|
-
};
|
46
|
-
|
47
|
-
creator.postcss = true;
|
48
|
-
|
49
|
-
module.exports = creator;
|
@@ -1,47 +0,0 @@
|
|
1
|
-
const creator = () => {
|
2
|
-
// side properties
|
3
|
-
const properties = ['top', 'right', 'bottom', 'left'];
|
4
|
-
|
5
|
-
return {
|
6
|
-
postcssPlugin: 'postcss-inset',
|
7
|
-
Declaration: {
|
8
|
-
'inset': (decl, { list }) => {
|
9
|
-
// space-separated side values (top, right, bottom, left)
|
10
|
-
const values = list.space(decl.value);
|
11
|
-
|
12
|
-
// conditionally add a right value
|
13
|
-
if (values.length === 1) {
|
14
|
-
values.push(values[0]);
|
15
|
-
}
|
16
|
-
|
17
|
-
// conditionally add a bottom value
|
18
|
-
if (values.length === 2) {
|
19
|
-
values.push(values[0]);
|
20
|
-
}
|
21
|
-
|
22
|
-
// conditionally add a left value
|
23
|
-
if (values.length === 3) {
|
24
|
-
values.push(values[1]);
|
25
|
-
}
|
26
|
-
|
27
|
-
// only transform up to 4 side values
|
28
|
-
if (values.length === 4) {
|
29
|
-
// for each side property
|
30
|
-
properties.forEach((property, index) => {
|
31
|
-
// create a new declaration for the side
|
32
|
-
decl.cloneBefore({
|
33
|
-
prop: property,
|
34
|
-
value: values[index]
|
35
|
-
});
|
36
|
-
});
|
37
|
-
}
|
38
|
-
|
39
|
-
decl.remove();
|
40
|
-
},
|
41
|
-
}
|
42
|
-
}
|
43
|
-
};
|
44
|
-
|
45
|
-
creator.postcss = true;
|
46
|
-
|
47
|
-
export default creator;
|
@@ -1,47 +0,0 @@
|
|
1
|
-
const creator = () => {
|
2
|
-
// side properties
|
3
|
-
const properties = ['top', 'right', 'bottom', 'left'];
|
4
|
-
|
5
|
-
return {
|
6
|
-
postcssPlugin: 'postcss-inset',
|
7
|
-
Declaration: {
|
8
|
-
'inset': (decl, { list }) => {
|
9
|
-
// space-separated side values (top, right, bottom, left)
|
10
|
-
const values = list.space(decl.value);
|
11
|
-
|
12
|
-
// conditionally add a right value
|
13
|
-
if (values.length === 1) {
|
14
|
-
values.push(values[0]);
|
15
|
-
}
|
16
|
-
|
17
|
-
// conditionally add a bottom value
|
18
|
-
if (values.length === 2) {
|
19
|
-
values.push(values[0]);
|
20
|
-
}
|
21
|
-
|
22
|
-
// conditionally add a left value
|
23
|
-
if (values.length === 3) {
|
24
|
-
values.push(values[1]);
|
25
|
-
}
|
26
|
-
|
27
|
-
// only transform up to 4 side values
|
28
|
-
if (values.length === 4) {
|
29
|
-
// for each side property
|
30
|
-
properties.forEach((property, index) => {
|
31
|
-
// create a new declaration for the side
|
32
|
-
decl.cloneBefore({
|
33
|
-
prop: property,
|
34
|
-
value: values[index]
|
35
|
-
});
|
36
|
-
});
|
37
|
-
}
|
38
|
-
|
39
|
-
decl.remove();
|
40
|
-
},
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
creator.postcss = true
|
46
|
-
|
47
|
-
export default creator
|
@@ -1,58 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "postcss-inset",
|
3
|
-
"version": "1.0.0",
|
4
|
-
"description": "Use the inset property in CSS",
|
5
|
-
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
6
|
-
"license": "CC0-1.0",
|
7
|
-
"repository": "jonathantneal/postcss-inset",
|
8
|
-
"homepage": "https://github.com/jonathantneal/postcss-inset#readme",
|
9
|
-
"bugs": "https://github.com/jonathantneal/postcss-inset/issues",
|
10
|
-
"main": "index.cjs.js",
|
11
|
-
"module": "index.es.mjs",
|
12
|
-
"files": [
|
13
|
-
"index.js"
|
14
|
-
],
|
15
|
-
"scripts": {
|
16
|
-
"clean": "git clean -X -d -f",
|
17
|
-
"build": "rollup index.js --file index.cjs.js --format cjs --exports default && rollup index.js --file index.es.mjs --format es --exports default",
|
18
|
-
"prepublish": "npm test",
|
19
|
-
"test": "echo 'Running tests...'; npm run test:js && npm run test:tape",
|
20
|
-
"test:js": "eslint *.js --cache --ignore-pattern .gitignore",
|
21
|
-
"test:tape": "postcss-tape"
|
22
|
-
},
|
23
|
-
"engines": {
|
24
|
-
"node": ">=4.0.0"
|
25
|
-
},
|
26
|
-
"dependencies": {
|
27
|
-
"postcss": "^6.0.1"
|
28
|
-
},
|
29
|
-
"devDependencies": {
|
30
|
-
"eslint": "^3.19.0",
|
31
|
-
"eslint-config-dev": "2.0.0",
|
32
|
-
"postcss-tape": "2.0.1",
|
33
|
-
"pre-commit": "^1.2.2"
|
34
|
-
},
|
35
|
-
"eslintConfig": {
|
36
|
-
"extends": "dev"
|
37
|
-
},
|
38
|
-
"keywords": [
|
39
|
-
"postcss",
|
40
|
-
"css",
|
41
|
-
"postcss-plugin",
|
42
|
-
"inset",
|
43
|
-
"position",
|
44
|
-
"top",
|
45
|
-
"right",
|
46
|
-
"bottom",
|
47
|
-
"left",
|
48
|
-
"sides",
|
49
|
-
"four",
|
50
|
-
"clockwise",
|
51
|
-
"vertical",
|
52
|
-
"horizontal",
|
53
|
-
"start",
|
54
|
-
"end",
|
55
|
-
"block",
|
56
|
-
"inline"
|
57
|
-
]
|
58
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# Release History
|
2
|
-
|
3
|
-
## v0.5.0, 2021-03-10
|
4
|
-
* replace `Object.assign` with `lodash.merge` for deep merge
|
5
|
-
* update `twig` to 1.15.4
|
6
|
-
* update devDependencies
|
7
|
-
|
8
|
-
---
|
9
|
-
|
10
|
-
## v0.4.2, 2020-11-09
|
11
|
-
* update `twig` to 1.15.3
|
12
|
-
* update devDependencies
|
13
|
-
|
14
|
-
---
|
15
|
-
|
16
|
-
## v0.4.1, 2020-08-18
|
17
|
-
* update `twig` to 1.15.2
|
18
|
-
* update devDependencies
|
19
|
-
|
20
|
-
---
|
21
|
-
|
22
|
-
## v0.4.0, 2020-08-04
|
23
|
-
* drop node 8 support
|
24
|
-
|
25
|
-
---
|
26
|
-
|
27
|
-
## v0.3.0, 2020-08-04
|
28
|
-
* update `twig` to 1.15.1
|
29
|
-
* update devDependencies
|
30
|
-
|
31
|
-
---
|
32
|
-
|
33
|
-
## v0.2.0, 2019-11-14
|
34
|
-
* update `twig` to 1.14.0
|
35
|
-
* update devDependencies
|
36
|
-
|
37
|
-
---
|
38
|
-
|
39
|
-
## v0.1.5, 2019-09-27
|
40
|
-
* fixes context inheritance
|
41
|
-
|
42
|
-
---
|
43
|
-
|
44
|
-
## v0.1.4, 2019-08-29
|
45
|
-
* update devDependencies
|
46
|
-
|
47
|
-
---
|
48
|
-
|
49
|
-
## v0.1.3, 2019-07-16
|
50
|
-
* fix npm vulnerabilities
|
51
|
-
|
52
|
-
---
|
53
|
-
|
54
|
-
## v0.1.2, 2019-07-15
|
55
|
-
* fix npm vulnerabilities
|
56
|
-
|
57
|
-
---
|
58
|
-
|
59
|
-
## v0.1.1, 2019-07-12
|
60
|
-
* eslint-plugin-node Requires Node.js >=8.10.0
|
61
|
-
* update deps
|
62
|
-
|
63
|
-
---
|
64
|
-
|
65
|
-
## v0.1.0, 2019-06-05
|
66
|
-
* first commit
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2019, Viktor Dmitrievtsev and the twig-renderer Contributors
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person
|
4
|
-
obtaining a copy of this software and associated documentation
|
5
|
-
files (the "Software"), to deal in the Software without
|
6
|
-
restriction, including without limitation the rights to use,
|
7
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the
|
9
|
-
Software is furnished to do so, subject to the following
|
10
|
-
conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
included in all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,93 +0,0 @@
|
|
1
|
-
[](https://gitlab.com/toptalo/twig-renderer/commits/master)
|
2
|
-
|
3
|
-
# twig-renderer
|
4
|
-
|
5
|
-
Renders Twig templates using Twig.js
|
6
|
-
|
7
|
-
Build upon [Twig.js](https://github.com/twigjs/twig.js), the JS port of the Twig templating language by John Roepke.
|
8
|
-
|
9
|
-
## Install
|
10
|
-
|
11
|
-
```shell
|
12
|
-
npm install @toptalo/twig-renderer --save
|
13
|
-
```
|
14
|
-
|
15
|
-
## Usage Example
|
16
|
-
|
17
|
-
```javascript
|
18
|
-
const TwigRenderer = require('@toptalo/twig-renderer');
|
19
|
-
|
20
|
-
const options = {
|
21
|
-
globals: '',
|
22
|
-
extensions: [],
|
23
|
-
functions: {},
|
24
|
-
filters: {},
|
25
|
-
context: {},
|
26
|
-
namespaces: {}
|
27
|
-
};
|
28
|
-
|
29
|
-
const twigRenderer = new TwigRenderer(options);
|
30
|
-
|
31
|
-
twigRenderer.render(templatePath).then(html => {
|
32
|
-
console.log(html);
|
33
|
-
}).catch(error => {
|
34
|
-
console.log(error.message);
|
35
|
-
});
|
36
|
-
```
|
37
|
-
|
38
|
-
## Options
|
39
|
-
|
40
|
-
#### options.globals
|
41
|
-
Type: `String`
|
42
|
-
Default value: `''`
|
43
|
-
|
44
|
-
Path to JSON file with global context variables.
|
45
|
-
|
46
|
-
#### options.extensions
|
47
|
-
Type: `Array`
|
48
|
-
Default value: `[]`
|
49
|
-
|
50
|
-
Can be an array of functions that extend TwigJS with [custom tags](https://github.com/twigjs/twig.js/wiki/Extending-twig.js-With-Custom-Tags).
|
51
|
-
|
52
|
-
#### options.functions
|
53
|
-
Type: `Object`
|
54
|
-
Default value: `{}`
|
55
|
-
|
56
|
-
Object hash defining [functions in TwigJS](https://github.com/twigjs/twig.js/wiki/Extending-twig.js#functions).
|
57
|
-
|
58
|
-
#### options.filters
|
59
|
-
Type: `Object`
|
60
|
-
Default value: `{}`
|
61
|
-
|
62
|
-
Object hash defining [filters in TwigJS](https://github.com/twigjs/twig.js/wiki/Extending-twig.js#filters).
|
63
|
-
|
64
|
-
#### options.context
|
65
|
-
Type: `Object`
|
66
|
-
Default value: `{}`
|
67
|
-
|
68
|
-
Object hash defining templates context variables.
|
69
|
-
|
70
|
-
#### options.namespaces
|
71
|
-
Type: `Object`
|
72
|
-
Default value: `{}`
|
73
|
-
|
74
|
-
Object hash defining namespaces.
|
75
|
-
|
76
|
-
## Context hierarchy
|
77
|
-
Template context extends in this order:
|
78
|
-
* `options.context` provided
|
79
|
-
* `options.globals` provided
|
80
|
-
* template JSON context files (stored in template path, with same name,
|
81
|
-
example: `/templates/index.json` for `/templates/index.twig`) if provided
|
82
|
-
|
83
|
-
## Contributing
|
84
|
-
In lieu of a formal style guide, take care to maintain the existing coding style.
|
85
|
-
Add functional tests for any new or changed functionality.
|
86
|
-
Lint your code using [ESLint](https://eslint.org/).
|
87
|
-
Test your code using [Jest](https://jestjs.io/).
|
88
|
-
|
89
|
-
## Sponsored by
|
90
|
-
[](https://designdepot.ru/?utm_source=web&utm_medium=npm&utm_campaign=twig-renderer)
|
91
|
-
|
92
|
-
## Release History
|
93
|
-
See the [CHANGELOG](CHANGELOG.md).
|
@@ -1,49 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@toptalo/twig-renderer",
|
3
|
-
"version": "0.5.0",
|
4
|
-
"description": "Renders Twig templates using Twig.js",
|
5
|
-
"keywords": [
|
6
|
-
"templating",
|
7
|
-
"twig",
|
8
|
-
"html",
|
9
|
-
"django"
|
10
|
-
],
|
11
|
-
"repository": {
|
12
|
-
"type": "git",
|
13
|
-
"url": "git@gitlab.com:toptalo/twig-renderer.git"
|
14
|
-
},
|
15
|
-
"bugs": {
|
16
|
-
"url": "https://gitlab.com/toptalo/twig-renderer/issues"
|
17
|
-
},
|
18
|
-
"author": {
|
19
|
-
"name": "toptalo",
|
20
|
-
"email": "spam.vitek@gmail.com"
|
21
|
-
},
|
22
|
-
"license": "MIT",
|
23
|
-
"files": [
|
24
|
-
"twig-renderer.js"
|
25
|
-
],
|
26
|
-
"main": "twig-renderer.js",
|
27
|
-
"scripts": {
|
28
|
-
"test": "jest",
|
29
|
-
"lint": "eslint '**/*.js'",
|
30
|
-
"lint-fix": "eslint --fix '**/*.js'"
|
31
|
-
},
|
32
|
-
"engines": {
|
33
|
-
"node": "^10.12.0 || >=12.0.0"
|
34
|
-
},
|
35
|
-
"dependencies": {
|
36
|
-
"lodash": "^4.17.21",
|
37
|
-
"twig": "^1.15.4"
|
38
|
-
},
|
39
|
-
"devDependencies": {
|
40
|
-
"eslint": "^7.21.0",
|
41
|
-
"eslint-config-standard": "^16.0.2",
|
42
|
-
"eslint-plugin-import": "^2.22.1",
|
43
|
-
"eslint-plugin-node": "^11.1.0",
|
44
|
-
"eslint-plugin-promise": "^4.3.1",
|
45
|
-
"eslint-plugin-standard": "^4.1.0",
|
46
|
-
"jest": "^26.6.3",
|
47
|
-
"jest-cli": "^26.6.3"
|
48
|
-
}
|
49
|
-
}
|
@@ -1,90 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
const Twig = require('twig');
|
4
|
-
const fs = require('fs');
|
5
|
-
const { merge } = require('lodash');
|
6
|
-
|
7
|
-
function hasFile (filePath) {
|
8
|
-
return fs.existsSync(filePath);
|
9
|
-
}
|
10
|
-
|
11
|
-
function readJSON (filePath) {
|
12
|
-
let result = null;
|
13
|
-
|
14
|
-
if (hasFile(filePath)) {
|
15
|
-
const rawData = fs.readFileSync(filePath);
|
16
|
-
result = JSON.parse(rawData);
|
17
|
-
}
|
18
|
-
|
19
|
-
return result;
|
20
|
-
}
|
21
|
-
|
22
|
-
module.exports = class TwigRenderer {
|
23
|
-
constructor (options) {
|
24
|
-
this.params = merge({
|
25
|
-
globals: '',
|
26
|
-
extensions: [],
|
27
|
-
functions: {},
|
28
|
-
filters: {},
|
29
|
-
context: {},
|
30
|
-
namespaces: {}
|
31
|
-
}, options);
|
32
|
-
|
33
|
-
let genericContext = this.params.context || {};
|
34
|
-
|
35
|
-
if (this.params.globals && typeof this.params.globals === 'string') {
|
36
|
-
genericContext = merge(genericContext, readJSON(this.params.globals));
|
37
|
-
}
|
38
|
-
|
39
|
-
this.genericContext = genericContext;
|
40
|
-
}
|
41
|
-
|
42
|
-
render (filePath) {
|
43
|
-
Twig.cache(false);
|
44
|
-
|
45
|
-
if (!Array.isArray(this.params.extensions)) {
|
46
|
-
throw new TypeError('\'extensions\' needs to be an array of functions!');
|
47
|
-
}
|
48
|
-
|
49
|
-
this.params.extensions.forEach(function (fn) {
|
50
|
-
Twig.extend(fn);
|
51
|
-
});
|
52
|
-
|
53
|
-
Object.keys(this.params.functions).forEach(name => {
|
54
|
-
const fn = this.params.functions[name];
|
55
|
-
if (typeof fn !== 'function') {
|
56
|
-
throw new TypeError(`${name} needs to be a function!`);
|
57
|
-
}
|
58
|
-
Twig.extendFunction(name, fn);
|
59
|
-
});
|
60
|
-
|
61
|
-
Object.keys(this.params.filters).forEach(name => {
|
62
|
-
const fn = this.params.filters[name];
|
63
|
-
if (typeof fn !== 'function') {
|
64
|
-
throw new TypeError(`${name} needs to be a function!`);
|
65
|
-
}
|
66
|
-
Twig.extendFilter(name, fn);
|
67
|
-
});
|
68
|
-
|
69
|
-
return new Promise((resolve, reject) => {
|
70
|
-
const templatePath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
|
71
|
-
const templateFile = filePath.substr(filePath.lastIndexOf('/') + 1);
|
72
|
-
const templateName = templateFile.substr(0, templateFile.lastIndexOf('.')) || templateFile;
|
73
|
-
const templateContextFile = `${templatePath}${templateName}.json`;
|
74
|
-
const context = merge({}, this.genericContext, readJSON(templateContextFile));
|
75
|
-
|
76
|
-
if (hasFile(filePath)) {
|
77
|
-
const output = Twig.twig({
|
78
|
-
async: false,
|
79
|
-
data: this.params.data,
|
80
|
-
path: filePath,
|
81
|
-
namespaces: this.params.namespaces
|
82
|
-
}).render(context);
|
83
|
-
|
84
|
-
resolve(output);
|
85
|
-
} else {
|
86
|
-
reject(new TypeError(`Could not find file '${filePath}'`));
|
87
|
-
}
|
88
|
-
});
|
89
|
-
}
|
90
|
-
};
|