Starting with v0.25.0, changelog entries will be categorized using the following labels from keep-a-changelog_:
added
: for new featureschanged
: for changes in existing functionalitydeprecated
: for once-stable features removed in upcoming releasesremoved
: for deprecated features removed in this releasefixed
: for any bug fixes
fixed
Reverts layout changes from 1.0 to fix block-layout-nesting bug.
There is a bug causing child blocks to be promoted up to ancestors when a nested layout/block is defined. It's not a common scenario, and probably hasn't been encountered in the wild yet since blocks were just introduced and haven't been documented yet. However, it's a bad bug, and would cause major problems if it surfaced.
The good news is that I know how to fix it. Bad news is that it will be time consuming and I need to make other changes before I get to that fix. Thus, in the meantime the best course of action is removing the blocks code.
Added
- Templates now uses [dry] for handling layouts
- Advanced template-inheritance features, like
extends
and blocks! See [dry] documentation for details.
Fixed
- Correctly handles arguments for the built-in singular helper when used with Handlebars.
Fixed
- Ensures the template rendering engine's context is preserved.
Added
- Views can now be created asynchronously by passing a callback as the last argument to
.addView
(or the method created by.create
, e.g..page
)
Fixed
- Ensures the
view
object hasengineStack
andlocalsStack
properties
- Bumps [base-data][] which removed
renameKey
option used when loading data. Use thenamespace
option instead.
- Bumps [base-engine][] to fix a bug in [engine-cache][].
- fixes
List
bug that was caused collection helpers to explode
There should be no breaking changes in this release. If you experience a regression, please create an issue.
- Externalizes a few core plugins to: [base-helpers][], [base-routes][], and [base-engine][]. The goal is to allow you to use only the plugins you need in your builds.
- Improvements to lookup functions:
app.getView()
andapp.find()
- Bumps [base][] to take advantages of code optimizations.
Breaking changes
- The
queue
property has been removed, as well as related code for loading views using events. This behavior can easily be added using plugins or existing emitters.
Non-breaking
- The
View
andItem
class have been externalized to modules [vinyl-item][] and [vinyl-view][] so they can be used in other libraries.
- Context: In general, context should be merged so that the most specific context wins over less specific. This fixes one case where locals was winning over front-matter
- Helpers: Exposes
.ctx()
method on helper context, to simplify merging context in non-built-in helpers - Engines: Fixes bug that was using default engine on options instead of engine that matches view file extension.
- Numerous dependency updates
- Fixes inheritance bug that only manifests in node v0.4.0
- Improved error handling in routes
- Removed
debug
methods and related code - Improve layout handling with respect to template types (
partial
,renderable
andlayout
) - Update dependencies
- Improved context handling
- Ensure collection middleware is handled after app middleware
- removes
.removeItem
method that was deprecated in v0.10.7 fromList
.handleView
is deprecated in favor of.handleOnce
and will be removed in a future version. Start using.handleOnce
now.- adds a static
Templates.setup()
method for initializing any setup code that should have access to the instance before any other use code is run. - upgrade to [base-data][] v0.4.0, which adds
app.option.set
,app.option.get
andapp.option.merge
Although 99% of users won't be effected by the changes in this release, there were some potentially breaking changes.
- The
render
andcompile
methods were streamlined, making it clear that.mergePartials
should not have been renamed tomergePartialsSync
. So that change was reverted. - Helper context: Exposes a
this.helper
object to the context in helpers, which has the helper name and options that were set specifically for that helper - Helper context: Exposes a
this.view
object to the context in helpers, which is the current view being rendered. This was (and still is) always expose onthis.context.view
, but it makes sense to add this to the root of the context as a convenience. We will deprecatethis.context.view
in a future version. - Helper context:
.get
,.set
and.merge
methods onthis.options
,this.context
and thethis
object in helpers.
- All template handling is async by default. Instead of adding
.compileSync
, we felt that it made more sense to add.compileAsync
, since.compile
is a public method and most users will expect it to be sync, and.compile
methods with most engines are typically sync. In other words,.compileAsync
probably won't be seen by most users, but we wanted to explain the decision to go against node.js naming conventions. - Improved layout detection and handling
- Adds helper methods, .hasAsyncHelper, .hasHelper, .getAsyncHelper, and .getHelper
- Ensures that both collection and app routes are handled when both are defined for a view
- Default
engine
can now be defined onapp
or a collection using usingapp.option('engine')
,views.option('engine')
- Default
layout
can now defined usingapp.option('layout')
,views.option('layout')
. No changes have been made toview.layout
, it should work as before. Resolves issue/#818 - Improves logic for finding a layout, this should make layouts easier to define and find going forward.
- The built-in
view
helper has been refactored completely. The helper is now async and renders the view before returning its content. - Adds
isApp
,isViews
,isCollection
,isList
,isView
,isGroup
, andisItem
static methods. All return true when the given value is an instance of the respective class. - Adds
deleteItem
method to List and Collection, anddeleteView
method to Views. - Last, the static
_.proto
property which is only exposed for unit tests was renamed to_.plugin
.
- Force-update [base][] to v0.6.4 to take advantage of
isRegistered
feature.
- Re-introduces fs logic to
getView
, now that the method has been refactored to be faster.
getView
method no longer automatically reads views from the file system. This was undocumented before and, but it's a breaking change nonetheless. The removed functionality can easily be done in a plugin.
- Fixes error messages when no engine is found for a view, and the view does not have a file extension.
- Fixes a lookup bug in render and compile that was returning the first view that matched the given name from any collection. So if a partial and a page shared the same name, if the partial was matched first it was returned. Now the
renderable
view is rendered (e.g. page)
- breaking change: changes parameters on
app.context
method. It now only accepts two arguments,view
andlocals
, sincectx
(the parameter that was removed) was technically being merged in twice.
- Exposes
isType
method onview
. Shouldn't be any breaking changes.
- breaking change: renamed
.error
method to.formatError
- adds
mergeContext
option - collection name is now emitted with
view
anditem
as the second argument - adds
isType
method for checking theviewType
on a collection - also now emits an event with the collection name when a view is created
- fixes bug where
default
layout was automatically applied to partials, causing an infinite loop in rare cases.