-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nicer package.json, prepare for release
- Loading branch information
Tobias Brennecke
committed
Jan 27, 2017
1 parent
ca3265a
commit 209f878
Showing
5 changed files
with
141 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
## The Thymol engine for Pattern Lab / Node | ||
The Thymol engine for Pattern Lab / Node | ||
======================================== | ||
|
||
This engine adds [Thymeleaf](http://www.thymeleaf.org/) support to the Node edition of Pattern Lab using [headissue/thymol-node](https://github.com/headissue/thymol-node). | ||
|
||
Installing | ||
---------- | ||
|
||
To install the Thymol engine in your edition, `npm install patternengine-node-thymol` should do the trick. | ||
|
||
Partial calls and lineage hunting are supported. Thymol does not support the mustache-specific syntax extensions, style modifiers and pattern parameters, because their use cases are addressed by the core Thymol feature set. | ||
Thymeleafs th:include is also not possible, use th:replace instead. | ||
Supported features | ||
------------------ | ||
|
||
- [x] [Includes](http://patternlab.io/docs/pattern-including.html) | ||
- [x] Lineage | ||
- [x] [Hidden Patterns](http://patternlab.io/docs/pattern-hiding.html) | ||
- [x] [Pseudo-Patterns](http://patternlab.io/docs/pattern-pseudo-patterns.html) | ||
- [x] [Pattern States](http://patternlab.io/docs/pattern-states.html) | ||
- [ ] [Pattern Parameters](http://patternlab.io/docs/pattern-parameters.html) (Accomplished instead using native Thymeleaf features) | ||
- [ ] [Style Modifiers](http://patternlab.io/docs/pattern-stylemodifier.html) (Accomplished instead using native Thymeleaf features) | ||
|
||
Partial calls and lineage hunting are supported. Thymol does not support the mustache-specific syntax extensions, style modifiers and pattern parameters, because their use cases are addressed by the core Thymol feature set. Thymeleafs th:include is also not possible, use th:replace instead. | ||
|
||
**Note**: You _cannot_ use `th:replace` with other attributes on a tag. `th:replace` gets interpreted and string-replaced by the patternengine, even before thymol has the chance to parse it. One workaround for this is by wrapping it with a `<th:block>`. | ||
**Note**: You *cannot* use `th:replace` with other attributes on a tag. `th:replace` gets interpreted and string-replaced by the patternengine, even before thymol has the chance to parse it. One workaround for this is by wrapping it with a `<th:block>`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,41 @@ | |
"version": "0.1.0", | ||
"main": "lib/engine_thymol.js", | ||
"dependencies": { | ||
"jquery": "2.2.4", | ||
"jquery": "^3.1.1", | ||
"domino": "1.0.26", | ||
"thymol-node": "2.0.1-pre.2" | ||
"thymol-node": "git+ssh://[email protected]:headissue/thymol-node.git" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^3.5.0", | ||
"nodeunit": "^0.10.2" | ||
}, | ||
"keywords": [ | ||
"Pattern Lab", | ||
"Atomic Web Design", | ||
"Node", | ||
"Grunt", | ||
"Gulp", | ||
"Javascript", | ||
"Thymeleaf", | ||
"Thymol" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/headissue/patternengine-node-thymol.git" | ||
}, | ||
"bugs": "https://github.com/headissue/patternengine-node-thymol/issues", | ||
"author": { | ||
"name": "Maximilian Richt" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Tobias Brennecke" | ||
} | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "eslint lib/**/*.js && eslint test/**/*.js && nodeunit test/*.js" | ||
}, | ||
"devDependencies": {}, | ||
"engines": { | ||
"node": ">=4.0" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"use strict"; | ||
|
||
var thymol = require('../lib/engine_thymol.js'); | ||
|
||
// Some basic tests using NodeUnit. Thymol itself is not tested. | ||
exports.thymolTests = { | ||
|
||
renderPattern: function renderPattern(test) { | ||
const patternContent = 'Hello, <th:block th:text="${whom}">World</th:block>!'; | ||
const pattern = { | ||
name: "Test find partials", | ||
template: patternContent, | ||
extendedTemplate: patternContent | ||
}; | ||
test.equal("Hello, universe!", thymol.renderPattern(pattern, {whom: "universe"})); | ||
test.done(); | ||
}, | ||
|
||
/** | ||
* Return the markup that should be replaced by the partial contents, ignore any surrounding HTML | ||
*/ | ||
findPartials: function (test) { | ||
const pattern = { | ||
name: "Test find partials", | ||
template: 'Ignored <div th:replace="atoms-basic-button">Foo</div> Ignred' | ||
}; | ||
test.deepEqual(['<div th:replace="atoms-basic-button">Foo</div>'], thymol.findPartials(pattern)); | ||
test.done(); | ||
}, | ||
|
||
// Done by thymeleaf using th:style and th:with. This function is too mustachified in Pattern Lab. | ||
findPartialsWithStyleModifiers: function (test) { | ||
test.deepEqual([], thymol.findPartialsWithStyleModifiers()); | ||
test.done(); | ||
}, | ||
|
||
// Use th:replace and th:include | ||
findPartialsWithPatternParameters: function (test) { | ||
test.deepEqual([], thymol.findPartialsWithPatternParameters()); | ||
test.done(); | ||
}, | ||
|
||
// not supported with thymol, list_item_hunter is too mustachified. | ||
findListItems: function (test) { | ||
test.deepEqual([], thymol.findListItems()); | ||
test.done(); | ||
}, | ||
}; |