Skip to content

Commit 749f648

Browse files
Merge pull request #1135 from ringods/feature/twigjs
[WIP] feat: switch engine-twig to use twing rather than node-twig
2 parents 020cbf2 + 4826315 commit 749f648

File tree

12 files changed

+477
-75
lines changed

12 files changed

+477
-75
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
.DS_Store
3+
patternlab.json
4+
.sass-cache/*
5+
/sass-cache
6+
Thumbs.db
7+
.idea/
8+
public
9+
dependencyGraph.json
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
![Pattern Lab Logo](/patternlab.png "Pattern Lab Logo")
2+
3+
# Pattern Lab Node - Development Edition Engine Twig
4+
5+
_here be dragons_
6+
7+
This Development Edition is a variant of [Edition Node](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node) for convience purposes only, loaded with the Twig Engine. The goals of this Development Edition are two-fold:
8+
9+
* Develop the [Twig Engine](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig)
10+
* Build and test against Twig pattern tree
11+
12+
> Development Editions of Pattern Lab provide the ability to work on and commit changes to select packages within the overall Pattern Lab [ecosystem](http://patternlab.io/docs/advanced-ecosystem-overview.html). This Edition is NOT stable.
13+
14+
15+
## Working on Pattern Lab's UI Locally
16+
17+
### Step 1: Install Dependencies
18+
Run the following in the root of the Pattern Lab repo:
19+
20+
```
21+
yarn run setup
22+
```
23+
24+
### Step 2
25+
Finally, go back into this folder, `cd packages/development-edition-engine-twig`, and start up the local dev server which watches UIKit and the local Pattern Lab instance for changes, live reloads, etc by running `yarn dev`
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@pattern-lab/development-edition-engine-twig",
3+
"private": true,
4+
"version": "0.0.1",
5+
"description": "The tree of components we use to test, develop and validate the twig engine (not engine-twig-php)",
6+
"scripts": {
7+
"postbootstrap": "patternlab install --starterkits @pattern-lab/starterkit-twig-demo",
8+
"pl:build": "patternlab build --config ./patternlab-config.json",
9+
"pl:help": "patternlab --help",
10+
"pl:install": "patternlab install --config ./patternlab-config.json",
11+
"pl:serve": "patternlab serve --config ./patternlab-config.json",
12+
"pl:version": "patternlab --version",
13+
"dev": "node ./node_modules/@pattern-lab/uikit-workshop/build-tools.js"
14+
},
15+
"keywords": [
16+
"Pattern Lab",
17+
"Atomic Web Design",
18+
"Node",
19+
"Twig",
20+
"Edition"
21+
],
22+
"author": "Ringo De Smet",
23+
"license": "MIT",
24+
"repository": {
25+
"type": "git",
26+
"url": "git://github.com/pattern-lab/patternlab-node.git"
27+
},
28+
"engines": {
29+
"node": ">=10.0"
30+
},
31+
"dependencies": {
32+
"@pattern-lab/cli": "^5.7.0",
33+
"@pattern-lab/core": "^5.7.0",
34+
"@pattern-lab/engine-twig": "^5.0.0",
35+
"@pattern-lab/starterkit-twig-demo": "^5.0.0",
36+
"@pattern-lab/uikit-workshop": "^5.7.1"
37+
},
38+
"workspaces": {
39+
"nohoist": [
40+
"**/@pattern-lab/starterkit-twig-demo"
41+
]
42+
}
43+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"cacheBust": true,
3+
"cleanPublic": true,
4+
"defaultPattern": "pages-homepage",
5+
"defaultShowPatternInfo": false,
6+
"ishControlsHide": {
7+
"s": false,
8+
"m": false,
9+
"l": false,
10+
"full": false,
11+
"random": false,
12+
"disco": false,
13+
"hay": true,
14+
"mqs": false,
15+
"find": false,
16+
"views-all": false,
17+
"views-annotations": false,
18+
"views-code": false,
19+
"views-new": false,
20+
"tools-all": false,
21+
"tools-docs": false
22+
},
23+
"ishViewportRange": {
24+
"s": [
25+
240,
26+
500
27+
],
28+
"m": [
29+
500,
30+
800
31+
],
32+
"l": [
33+
800,
34+
2600
35+
]
36+
},
37+
"logLevel": "info",
38+
"outputFileSuffixes": {
39+
"rendered": ".rendered",
40+
"rawTemplate": "",
41+
"markupOnly": ".markup-only"
42+
},
43+
"paths": {
44+
"source": {
45+
"root": "source/",
46+
"patterns": "source/_patterns/",
47+
"data": "source/_data/",
48+
"meta": "source/_meta/",
49+
"annotations": "source/_annotations/",
50+
"styleguide": "dist/",
51+
"patternlabFiles": {
52+
"general-header": "views/partials/general-header.mustache",
53+
"general-footer": "views/partials/general-footer.mustache",
54+
"patternSection": "views/partials/patternSection.mustache",
55+
"patternSectionSubtype": "views/partials/patternSectionSubtype.mustache",
56+
"viewall": "views/viewall.mustache"
57+
},
58+
"js": "source/js",
59+
"images": "source/images",
60+
"fonts": "source/fonts",
61+
"css": "source/css"
62+
},
63+
"public": {
64+
"root": "public/",
65+
"patterns": "public/patterns/",
66+
"data": "public/styleguide/data/",
67+
"annotations": "public/annotations/",
68+
"styleguide": "public/styleguide/",
69+
"js": "public/js",
70+
"images": "public/images",
71+
"fonts": "public/fonts",
72+
"css": "public/css"
73+
}
74+
},
75+
"patternExtension": "twig",
76+
"patternStateCascade": [
77+
"inprogress",
78+
"inreview",
79+
"complete"
80+
],
81+
"patternExportDirectory": "pattern_exports",
82+
"patternExportPatternPartials": [],
83+
"serverOptions": {
84+
"wait": 1000
85+
},
86+
"starterkitSubDir": "dist",
87+
"styleGuideExcludes": [],
88+
"theme": {
89+
"color": "dark",
90+
"density": "compact",
91+
"layout": "horizontal"
92+
},
93+
"uikits": [
94+
{
95+
"name": "uikit-workshop",
96+
"outputDir": "",
97+
"enabled": true,
98+
"excludedPatternStates": [],
99+
"excludedTags": []
100+
}
101+
],
102+
"engines": {
103+
"twig": {
104+
"namespaces": {
105+
"atoms": "source/_patterns/00-atoms/",
106+
"molecules": "source/_patterns/01-molecules/",
107+
"organisms": "source/_patterns/02-organisms/",
108+
"templates": "source/_patterns/03-templates/",
109+
"pages": "source/_patterns/04-pages/",
110+
"macros": "source/_macros/"
111+
}
112+
}
113+
}
114+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

packages/engine-twig/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
## The Twig PatternEngine for Pattern Lab / Node
22

3-
To install the Twig engine in your edition, `npm install @pattern-lab/engine-twig` should do the trick.
3+
To install the Twig engine in your edition, `npm install @pattern-lab/engine-twig` should do the trick. This pattern engine uses the [`twing`](https://www.npmjs.com/package/twing) library.
44

55
## Supported features
66

7-
Level of support is more or less full. Partial calls and lineage hunting are supported. Twig does not support the mustache-specific syntax extensions, style modifiers and pattern parameters, because their use cases are addressed by the core Twig feature set.
7+
Level of support for Twig constructs is on the level that the `twing` library supports. The following partial resolution schemes (`includes`, `extends`, `import`) are supported:
88

9-
We are looking for help with the following issues:
9+
* relative file paths: standard by `twing` libary
10+
* namespaces: standard by `twing` library, `engine-twig` only passes the configuration from `patternlab-config.json`
11+
* Patternlab pattern names: integration between Patternlab and `twing` implemented by a custom [`loader`](https://nightlycommit.github.io/twing/api.html#create-your-own-loader)
12+
13+
Now that this engine uses a better Twig Javascript library, the following issues are resolved:
1014

1115
* [Pattern Lab does not support twig extends](https://github.com/pattern-lab/patternlab-node/issues/554)
1216
* [Verify maturity of Twig engine](https://github.com/pattern-lab/patternlab-node/issues/285)

0 commit comments

Comments
 (0)