- Fixes #286 - Add res.marko(templateData) for use with Express (@mlrawlings)
- Fixes #288 - Provide API for discovering custom tags and attributes for autocomplete/tooling purposes
- Documentation improvements
- Fixes #280 - Switch from jsonminify to strip-json-comments
- Updated docs for Koa and Hapi
- Additional tests for Node.js v6
- Fixes #274 - marko-compiler-options tag is not properly ended when using raw parsing (for prettyprint)
- Fixes #268 - this.write is not a function for empty ArrayExpression
- Fixes #262 - node-require module removes
.marko
extension from filenames in compiled code
- Fixes #267 - Shorthand CSS class name cannot be combined with object/array class names
- Fixed #266 - Hot reloading fails if original template is deleted
- Fixed error reporting when using
compiler.parseRaw()
- Added test for #262
- Improved whitespace removal for text nodes directly below the root
- Fixes #254 - Allow preserve whitespace to be enabled at the global level
- Fixes #240 - Always trim start and end of template (even if preserveWhitespace is true)
- Fixes #260 - Circular custom tags causes infinite recursion when writeToDisk is set to false
- Minor internal cleanup
- Don't wrap exception in
parseJavaScript
if error object was not created by Esprima
- Fixes #257 - Placeholders don't render for out-of-order async fragments
- Fixes #256 - Convert attributes to title case if no attributes are declared for a custom tag
- Use
<noscript>
for out-of-order async fragment placeholders
- Store
tagDef
withHtmlElement
node (needed for pretty printing)
- Docs: Fixed minor issues in docs
- Reintroduced support for the
MARKO_CLEAN
environment variable:MARK_CLEAN=true node server.js
- Fixes circular dependency issue between runtime/index.js and hot-reload/index.js
- Fixes circular dependency issue between runtime/index.js and hot-reload/index.js
- Fixes #203 - Incorrect behavior when attrs is used on a standard HTML tag with a tag def
- Fixes #202 - Pass along options to compiler when loading a template
- Added support for automatically discovering taglibs from installed packages that are scoped. (PR #183 by @tropperstyle)
- Fixes circular dependency issue between
hot-reload/index.js
andruntime/index.js
- Fixes #167 - Nested tags only work one level deep
- docs: don't exclude docs in .npmignore
- Fixes #161 - Nested tags with no body content are not handled correctly
- Fixes #140 - Also de-dupe cached taglibs in finder
- Make loading template from String template source easier:
var template = marko.load(
templatePath,
'Hello $!{data.name}!');
NOTE: Loading directly from source only works on the server
- Use shorter relative paths in error messages
- Fixes #150 - Provide option to prevent writing compiled templates to disk. Example usage:
require('marko/compiler').defaultOptions.writeToDisk = false;
NOTE: If you disable writing compiled templates to disk then it will be a little harder to debug errors in templates on the server since the stack trace will refer to a file that has not been written to disk.
For a more complete list of compiler options please see: http://markojs.com/docs/marko/javascript-api/#defaultoptions
- Fixes #140 - De-dupe taglibs by module name
- Documentation: Miscellaneous changes
- Fixed a typo for
rendererFunc
in helpers.js
(commit: 0205a47f04911f34ca4d458970d710f81a143987)
- New language feature:
unless
support added
- Automatically enable hot-reload and browser-refresh if launched using browser-refresh
- Documentation: Miscellaneous changes
- Fixes #137 - adds support for dynamic HTML tag names
- Improvement: Better resolving of tag renderer
- Compiler: Fix to make compiler work in the browser
- Fixes #135 Allow "attrs" attribute on custom tags
- Improved handling of imports
- Better handling of loading taglibs with circular dependencies
- Handle circular taglib imports
- Fixes #131 - Recursively handle taglib imports
- Added a
.npmignore
file - Fixed licensing header in source
- Documentation: improved docs for input.renderBody()
- Documentation: Miscellaneous changes
- Fixes #122 Don't allow invalid attributes when using shorthand
- Fixes #122 Typo in hasAttributes
- Fixes #127 - Make sure all possible input files are accounted for when checking if a compiled template is up-to-date
- Use
browser.json
files instead ofoptimizer.json
files - Documentation: Improved docs for async taglib
- Documentation: Added empty() and notEmpty() helpers to the readme
- Added Martin Aberer as a maintainer
- Documentation: Miscellaneous changes
- New logo!
- Fixes #118 Better error when parsing JSON file for tag
- Testing: More test cases related to empty attributes
- Documentation: Clarification for the Node.js require extension
- Documentation: doc reference for
getLength()
of loopstatus-var
- Documentation: Added reference to sublime-marko under the tools section.
- Fixes #109 - Allow
compiler.createNode('div')
- Fixes #108 - Improve how the
MARKO_CLEAN
env variable is handled
- Minor documentation changes
- Allow
.html
extension for layouts (Fix for marko-js-archive/marko-layout#2)
- Make require('marko/node-require').install() a noop in the browser
- Improvement: Allow
template-data
to be combined with other attributes on the<include>
tag - Documentation: Fixes #98 - docs for
<include template-data="...">
- Fixes #96 - Allow relative, dynamic include paths
- Internal change: Additional test cases added for using promises with async fragments
- Fixes #73 - Prevent same taglib from being loaded multiple times
- Fixes #88 - Assign global data to the correct out
- Fixes #27 - IE conditional comments (e.g.,
<!--[if lt IE 9]><div><![endif]-->
) are automatically preserved. Previously, all HTML comments were stripped out when loading a template. For example: - Added support for
<compiler-options comments="preserve"/>
to enable comments to preserved in a template. For example:
<compiler-options comments="preserve"/>
Hello
<!--This comment should be preserved-->
World
Output:
Hello
<!--This comment should be preserved-->
World
- Performance improvements
'use strict';
- Optimized render code paths
- Code cleanup
- Compatibility fixes for Node.js 0.12
- Bad:
fs.readFile(path, 'utf8')
- Good:
fs.readFile(path, {encoding: 'utf8'})
- Bad:
- 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.
- Fixes edge case: More precise regular expression for decoding HTML entities
- Internal: Fixes #75 Always assign the tag property to custom tag nodes
- Improvement to allow taglibs to be imported from other taglibs (commit)
- 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>
Fixes #66 - Allow circular dependencies when loading templates
- Testing framework changes
- Fixes #65 - Generated variable name is an empty string in some cases
- Fixes #53 Merge c-input with attr props
Fixes #60 Don't replace special operators for body functions
- 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
- Fixes #51 Allow body content to be mapped to a String input property
- Fixes #52 Remove JavaScript comments from JSON taglib files before parsing
- Fixes #50 Initialize the loader after the runtime is fully initialized
- Fixes #50 Ensure that all instances of marko have hot-reload and browser-refresh enabled
- Allowing complex var names (i.e. LHS) for the
<assign>
tag.
- Minor change: Slight improvement to code to resolve tag handler
- Minor change: Improve how renderer is resolved
- Fixes #48 name in marko-tag.json should override default name given during discovery
- Fixes #47 - Added support for "taglib-imports"
- 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
- Added method for custom node compilers to get access to the
escapeXml
function at runtime
- Fixes #39 - Added missing return when using hot-reload
- Fixed bad publish
- Better merging of tags when loading and merging taglibs
- Changes to avoid problems associated with the same taglib being found multiple times in the search path
renderBody
function is only added if tag has children
- Fixed #36 - Don't use
invokeBody()
in the cache taglib
- ❗ Fixed #36 - Deprecated - When using
<include>
with body content, nested body content is now passed in asString
property namedbody
. Old behavior: nested content would be passed in as aFunction
property namedinvokeBody
that would return theString
value of the nested content.invokeBody()
has been deprecated.
- Fixed #36 - Don't use
invokeBody()
in test code and the HTML comments tag
- ❗ Fixed #36 - Deprecated
input.invokeBody()
in favor ofinput.renderBody(out)
- Fixed #37 - Duplicate input property for custom tag renderers
- Fixed #35 - Added support for
<compiler-options>
. Example:
<compiler-options whitespace="preserve" />
A
B
C
- Dynamic attributes for scanned tags without a tag will have dashes removed by default.
- ❗ When using
tags-dir
to 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.js
if found. New search order:renderer.js
(userenderer.js
if it exists)index.js
(useindex.js
if it exists and assume it exports arenderer
orrender
property)template.marko
(use the template as the renderer if norenderer.js
orindex.js
)
- ❗ Changes to the taglib directory scanner could break existing code. Specifically, if a UI component directory had an
index.js
file and atemplate.marko
file then in inmarko@<2
thetemplate.marko
file would have been selected as the renderer. Inmarko@2.x
, theindex.js
will be selected as the tag renderer.
- Updated taglib directory scanner to use
- ❗ Removed support for mapping a tag renderer to a module with a
process
method - Removed sub-module
marko/renderer
that exports raptor-renderer
- Added back code to allow the new marko runtime to load templates compiled by an earlier compiler that used
module.exports
- Fixed #32. Switched from
module.exports = function create(__helpers) { ... }
toexports.create = function(__helpers) { ... }
to avoid circular dependency problems
- Added support for adding "static" code to the top of a compiled template (helpful for initializing variables or running code once).
- Added sub-module
marko/renderer
that exports raptor-renderer
- Changes to avoid unoptimized code in V8
- Handle case where template was loaded before hot-reload was enabled
- Added support for
$global
inrenderSync