Comparing version 3.7.3 to 3.8.0
# CHANGELOG | ||
## master | ||
## 3.8.0 | ||
* Refactor monkberry-loader hot replacement. | ||
* Fix monkberry-parser dependency version. | ||
### 3.7.3 | ||
* Optimized code generation function. 30% less generate code. | ||
## 3.7.1 | ||
### 3.7.2 | ||
* Fixed block naming and nested block naming. | ||
* Improved error messages. | ||
### 3.7.1 | ||
* Fixed block naming and nested block naming. | ||
## 3.7.0 | ||
@@ -35,3 +43,3 @@ | ||
## 3.2.1 | ||
### 3.2.1 | ||
@@ -44,15 +52,15 @@ * Fixed code generation for empty expressions. | ||
## 3.1.6 | ||
### 3.1.6 | ||
* Fixed SVG creation. | ||
## 3.1.5 | ||
### 3.1.5 | ||
* Fixed `getElementById()` algorithm. | ||
## 3.1.4 | ||
### 3.1.4 | ||
* Fixed bug in Opera 12.16 in `querySelector()`. | ||
## 3.1.3 | ||
### 3.1.3 | ||
@@ -62,7 +70,7 @@ * Fixed typo in error message. | ||
## 3.1.2 | ||
### 3.1.2 | ||
* Fixed very sophisticated bug with local variables. | ||
## 3.1.1 | ||
### 3.1.1 | ||
@@ -75,3 +83,3 @@ * Added `createDocument()`, and `dom()` is deprecated. | ||
## 3.0.8 | ||
### 3.0.8 | ||
@@ -78,0 +86,0 @@ * Various bug fixes. |
@@ -1,7 +0,29 @@ | ||
/** _ _ | ||
* /\/\ ___ _ __ | | _| |__ ___ _ __ _ __ _ _ | ||
* / \ / _ \| '_ \| |/ / '_ \ / _ \ '__| '__| | | | | ||
* / /\/\ \ (_) | | | | <| |_) | __/ | | | | |_| | | ||
* \/ \/\___/|_| |_|_|\_\_.__/ \___|_| |_| \__, | | ||
* |___/ | ||
/** _ _ | ||
* /\/\ ___ _ __ | | _| |__ ___ _ __ _ __ _ _ | ||
* / \ / _ \| '_ \| |/ / '_ \ / _ \ '__| '__| | | | | ||
* / /\/\ \ (_) | | | | <| |_) | __/ | | | | |_| | | ||
* \/ \/\___/|_| |_|_|\_\_.__/ \___|_| |_| \__, | | ||
* |___/ | ||
* | ||
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | ||
* Enter -> | | | | | | | ||
* + + + +---+ +---+---+ +---+---+ + + +---+ + +---+ + + + | ||
* | | | | | | | | | | | | ||
* +---+---+---+---+---+ +---+---+---+---+ +---+---+ +---+ + +---+---+ + | ||
* | | | | | | | | | | | ||
* + + + +---+---+---+ + + +---+---+ + +---+ + +---+---+ + + | ||
* | | | | | | | | | | | | ||
* + +---+---+ +---+ + + +---+ + +---+---+---+---+---+ + + +---+ | ||
* | | | | | | | | | | | | | | | ||
* + +---+ +---+ +---+---+---+ + + + + + + + +---+---+ + + | ||
* | | | | | | | | | | | | | | ||
* +---+---+---+ +---+ + + + +---+---+---+ +---+ +---+---+ + + + | ||
* | | | | | | | | | | | | ||
* + + + +---+---+---+ +---+ + + + +---+ +---+---+ +---+---+ + | ||
* | | | | | | | | | | | | | | ||
* + + +---+---+ +---+---+---+ +---+ +---+ + + + + + +---+ + | ||
* | | | | | | | | | | | ||
* +---+---+ + + +---+---+---+---+ +---+ +---+ + +---+---+ + +---+ | ||
* | | | | | | -> Exit | ||
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | ||
*/ | ||
@@ -63,3 +85,3 @@ (function (document) { | ||
// Render new view. | ||
var view = this._render(template, undefined, undefined, true); | ||
var view = this.render(template, undefined, undefined, {omit: true}); | ||
@@ -114,3 +136,3 @@ // Set view hierarchy. | ||
// Render new view. | ||
var view = this._render(template, undefined, undefined, true); | ||
var view = this.render(template, undefined, undefined, {omit: true}); | ||
@@ -151,15 +173,8 @@ // Set view hierarchy. | ||
* @param {boolean} noCache - Do not take views from pool. | ||
* @param {Object} options - Optional. Extra render options. | ||
* @return {Monkberry.View} | ||
*/ | ||
Monkberry.prototype.render = function (name, values, noCache) { | ||
return this._render(name, values, noCache); | ||
}; | ||
/** | ||
* This method is used only for private rendering of views. | ||
* @private | ||
*/ | ||
Monkberry.prototype._render = function (name, values, noCache, noOnRender) { | ||
Monkberry.prototype.render = function (name, values, noCache, options) { | ||
noCache = noCache || false; | ||
noOnRender = noOnRender || false; | ||
var omitCallback = options && options.omit || false; | ||
@@ -182,3 +197,3 @@ if (this.templates[name]) { | ||
if (!noOnRender && view.onRender) { | ||
if (!omitCallback && view.onRender) { | ||
view.onRender(); | ||
@@ -185,0 +200,0 @@ } |
{ | ||
"name": "monkberry", | ||
"version": "3.7.3", | ||
"version": "3.8.0", | ||
"description": "JavaScript DOM Template Engine", | ||
@@ -33,3 +33,3 @@ "bin": "bin/monkberry", | ||
"commander": "^2.9.0", | ||
"monkberry-parser": "^3.7.0", | ||
"monkberry-parser": "3.8.*", | ||
"source-map": "^0.5.3", | ||
@@ -36,0 +36,0 @@ "asciitree": "^1.0.2" |
@@ -45,2 +45,3 @@ # Monkberry - JavaScript template engine | ||
- [Comments](#comments) | ||
- [Blocks](#blocks) | ||
- [API Reference](#api-reference) | ||
@@ -457,4 +458,7 @@ - [Monkberry](#monkberry) | ||
To get info about prerendered template in runtime, use `monkberry.pool.store`. | ||
To get info about prerendered template in runtime, use `monkberry.getPoolInfo()`. | ||
> Note what prerender works only with first level DOM nodes. | ||
> This means you need to manually prerender templates used in if/for tags. | ||
> Look at [block](#blocks) statement for example. | ||
@@ -550,2 +554,29 @@ ### Pool | ||
### Blocks | ||
Allows to define part of template as separate block: | ||
```twig | ||
{% block "partial" %} | ||
... | ||
{% endblock %} | ||
``` | ||
This is very usefull then prerendering parts of templates, especially in loops. | ||
```twig | ||
{% for key, value of items %} | ||
{% block "item" %} | ||
... | ||
{% endblock %} | ||
{% endfor %} | ||
``` | ||
When to prerender loop block: | ||
```js | ||
monkberry.prerender('item', 10); // Prerender item template 10 times. | ||
``` | ||
## API Reference | ||
@@ -552,0 +583,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115250
2563
715
Updatedmonkberry-parser@3.8.*