mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
8.0 KiB
8.0 KiB
Changelog
2.x
2.5.x
2.5.0
- Fixes #78 - Custom Node.js require extension for Marko template files. Example usage:
// Install the Node.js require extension in your application's main script (server-side only)
require('marko/node-require').install();
// Now you can require `*.marko` files just like any other JavaScript module
var template = require('./hello.marko');
var html = template.renderSync({ name: 'Frank' });
- Compiled templates now export a loaded Template instance. In the previous version of marko, compiled templates exported a function that could be used to create a loaded Template instance.
2.4.x
2.4.3
- Fixes edge case: More precise regular expression for decoding HTML entities
2.4.2
- Internal: Fixes #75 Always assign the tag property to custom tag nodes
2.4.1
- Improvement to allow taglibs to be imported from other taglibs (commit)
2.4.0
- Added support for short-hand tags and attributes
Old marko-taglib.json:
{
"tags": {
"my-hello": {
"renderer": "./hello-renderer",
"attributes": {
"name": "string"
}
}
}
}
Short-hand marko-taglib.json:
{
"<my-hello>": {
"renderer": "./hello-renderer",
"@name": "string"
}
}
- Fixes #61 Simplify parent/child relationships
Marko now supports custom tags in the following format: <parent_tag.nested_tag>
Example usage:
<ui-tabs orientation="horizontal">
<ui-tabs.tab title="Home">
Content for Home
</ui-tabs.tab>
<ui-tabs.tab title="Profile">
Content for Profile
</ui-tabs.tab>
<ui-tabs.tab title="Messages">
Content for Messages
</ui-tabs.tab>
</ui-tabs>
ui-tabs/marko-tag.json
{
"@orientation": "string",
"@tabs <tab>[]": {
"@title": "string"
}
}
ui-tabs/renderer.js
var template = require('marko').load(require.resolve('./template.marko'));
exports.renderer = function(input, out) {
var tabs = input.tabs;
// Tabs will be in the following form:
// [
// {
// title: 'Home',
// renderBody: function(out) { ... }
// },
// {
// title: 'Profile',
// renderBody: function(out) { ... }
// },
// {
// title: 'Messages',
// renderBody: function(out) { ... }
// }
// ]
console.log(tabs.length); // Output: 3
template.render({
tabs: tabs
}, out);
};
ui-tabs/template.marko
<div class="tabs">
<ul class="nav nav-tabs">
<li class="tab" for="tab in data.tabs">
<a href="#${tab.title}">
${tab.title}
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane" for="tab in data.tabs">
<invoke function="tab.renderBody(out)"/>
</div>
</div>
</div>
2.3.x
2.3.2
Fixes #66 - Allow circular dependencies when loading templates
2.3.1
- Testing framework changes
- Fixes #65 - Generated variable name is an empty string in some cases
2.3.0
- Fixes #53 Merge c-input with attr props
2.2.x
2.2.2
Fixes #60 Don't replace special operators for body functions
2.2.1
- Fixes #58 Added support for MARKO_CLEAN env variable (force recompile of all loaded templates). Example usage:
MARKO_CLEAN=true node run.js
- Code formatting: add spaces in var code
2.2.0
- Fixes #51 Allow body content to be mapped to a String input property
- Fixes #52 Remove JavaScript comments from JSON taglib files before parsing
2.1.x
2.1.6
- Fixes #50 Initialize the loader after the runtime is fully initialized
2.1.5
- Fixes #50 Ensure that all instances of marko have hot-reload and browser-refresh enabled
2.1.4
- Allowing complex var names (i.e. LHS) for the
<assign>tag.
2.1.3
- Minor change: Slight improvement to code to resolve tag handler
2.1.2
- Minor change: Improve how renderer is resolved
2.1.1
- Fixes #48 name in marko-tag.json should override default name given during discovery
2.1.0
- Fixes #47 - Added support for "taglib-imports"
2.0.x
2.0.12
- Fixes #31 - Add support for providing prefix when scanning for tags
- Allow "code" to be a function that lazily evaluates to a code string during code generation
2.0.11
- Added method for custom node compilers to get access to the
escapeXmlfunction at runtime
2.0.10
- Fixes #39 - Added missing return when using hot-reload
2.0.9
- Fixed bad publish
2.0.8
- Better merging of tags when loading and merging taglibs
2.0.7
- Changes to avoid problems associated with the same taglib being found multiple times in the search path
2.0.6
renderBodyfunction is only added if tag has children
2.0.5
- Fixed #36 - Don't use
invokeBody()in the cache taglib
2.0.4
- ❗ Fixed #36 - Deprecated - When using
<include>with body content, nested body content is now passed in asStringproperty namedbody. Old behavior: nested content would be passed in as aFunctionproperty namedinvokeBodythat would return theStringvalue of the nested content.invokeBody()has been deprecated.
2.0.3
- Fixed #36 - Don't use
invokeBody()in test code and the HTML comments tag
2.0.2
- ❗ Fixed #36 - Deprecated
input.invokeBody()in favor ofinput.renderBody(out) - Fixed #37 - Duplicate input property for custom tag renderers
2.0.1
- Fixed #35 - Added support for
<compiler-options>. Example:
<compiler-options whitespace="preserve" />
A
B
C
2.0.0
- Dynamic attributes for scanned tags without a tag will have dashes removed by default.
- ❗ When using
tags-dirto discover tags that do not have amarko-tag.json, the previous behavior was to allow all attributes and to use the actual attribute name as the input property name. For example, when using<hello first-name="John">, first name would need to be read in asinput['first-name']. This was changed such that the first name property should now be read in asinput.firstName(dashes removed and converted to camel case)
- ❗ When using
- Changes to allow UI component to be put into a single JS file:
- Updated taglib directory scanner to use
index.jsif found. New search order:renderer.js(userenderer.jsif it exists)index.js(useindex.jsif it exists and assume it exports arendererorrenderproperty)template.marko(use the template as the renderer if norenderer.jsorindex.js)
- ❗ Changes to the taglib directory scanner could break existing code. Specifically, if a UI component directory had an
index.jsfile and atemplate.markofile then in inmarko@<2thetemplate.markofile would have been selected as the renderer. Inmarko@2.x, theindex.jswill be selected as the tag renderer.
- Updated taglib directory scanner to use
- ❗ Removed support for mapping a tag renderer to a module with a
processmethod - Removed sub-module
marko/rendererthat exports raptor-renderer
1.x
1.6.x
1.6.1
- Added back code to allow the new marko runtime to load templates compiled by an earlier compiler that used
module.exports
1.6.0
- Fixed #32. Switched from
module.exports = function create(__helpers) { ... }toexports.create = function(__helpers) { ... }to avoid circular dependency problems
1.5.x
1.5.8
- Added support for adding "static" code to the top of a compiled template (helpful for initializing variables or running code once).
1.5.7
- Added sub-module
marko/rendererthat exports raptor-renderer
1.5.6
- Changes to avoid unoptimized code in V8
1.5.5
- Handle case where template was loaded before hot-reload was enabled
1.5.4
- Added support for
$globalinrenderSync