Upgrade
Upgrade Instructions
To upgrade your DocPad installation from an older version to the latest, check out the latest installation instructions as well as the upgrade manuals below.
Upgrading from 5.x to 6.x (v6 is the latest stable version)
Changes affecting configuration:
Removed the following configuration options:
documentsPath
,filesPath
, andlayoutsPath
. Use their array-based alternatives instead:documentsPaths
,filesPaths
, andlayoutsPaths
.
Changes affecting templates:
Removed
require
fromtemplateData
. Instead, specify it in yourdocpad.cson
orserver.coffee
file insteadRemoved
database
,documents
,collections
,blocks
fromtemplatedata
. Instead, use their helper based alternatives:getDatabase()
,getCollection('documents')
,getCollection('collectionName')
,getBlock('blockName')
Changes affecting everyone:
Removed the prototypes
String::startsWith
,String::finishesWith
,Array::hasCount
,Array::has
as no one ever used themPlugin versions have been bumped to
2.x
for DocPad v6.x compatibility. You should update all your DocPad plugins versions in yourpackage.json
to2.0.x
(e.g.,"docpad-plugin-eco": "2.0.x"
) then runnpm install
to install the new versions of the plugins
Changes affecting plugin developers:
Removed
docpadInstance.documents
. UsedocpadInstance.getCollection('documents')
instead.Plugin tests are now run via
npm test
on your plugin directory, allowing you to use whatever test runner you wantDocPad and the tester helpers have moved from Mocha to Joe, you'll probably want to do the same
Upgrading from 4.x to 5.x
Documents, Partials and Layouts (which extend from the File Class) are now Backbone Models
For end-users this will have minimal effect, as
@document
inside thetemplateData
will have all the same attributes. However, any function calls will now only be accessible via the new@documentModel
. This is because@documentModel
is the backbone model, and@document
is the JSONified version of the backbone model (e.g.,@document
is the same as@documentModel.toJSON()
).For plugin developers this affects how you will retrieve and set attributes for documents - which now use the Backbone getters and setters instead of directly reading and writing to and from the attributes directly (e.g.,
document.relatedDocuments = []
now becomesdocument.set(relatedDocuments:[])
instead)
Query-Engine has been updated from version 0.6 to version 1.1
For end-users this will have an effect wherever
@database
is used, as that is now represented by the new Query-Engine v1.1 collection, which has several changes. The most significant re@database.find
is now@database.findAll
, and that they now only have a synchronous interfacee. E.g. the@database.findAll
selector(err, results) ->
should now beresults = @database.findAll(selector)
For plugin developers, this affects any
docpad.documents
,docpad.partials
, anddocpad.layouts
calls with the same advice as those for end-users.
Plugins are now handled via npm dependencies instead of being directly handled by DocPad and end-users. This is the most significant change and affects everybody.
For end-users, you will need to add the plugins you use to your website's
package.json
file. You can refer thepackage.json
file of thecanvas.docpad
skeleton here for how to do this. Once added to your website'spackage.json
file, run anpm install
to install them.For plugin developers, there have been several important changes:
All plugins must now have
docpad-plugin
inside thekeywords
property of theirpackage.json
file. It is also highly recommended to ensure your plugin's name follows thedocpad-plugin-#{pluginName}
convention as this may become mandatory at a later date.You can now feel free to publish your plugin via npm (e.g.,
npm publish
) and add your plugin to the Plugins page so others can install it themselves (e.g.,npm install docpad-plugin-#{pluginName}
).
Upgrading from 3.x to 4.x
Skeletons are no longer cached, which means that you can no longer create a new website using a skeleton while offline. While this can be a pain, it was an essential change in order to improve stability and reduce complexity of the code base.
A document's
title
will no longer default to the document'sfilename
if not set. Instead a new property calledname
exists, which can be set by your document meta data. This is so thetitle
property can be used for Page Titles (e.g.,<title>
) whereas thename
property can be used for navigation listings etc.The DocPad core has been cleaned up a lot, and as such so has the way plugin events are triggered. We now utilise balUtil's emitSync and emitAsync instead of the old
triggerPluginEvent
. This means that for now, plugin priorities are discarded - however they may be added back in the future (so leave them in there if you have them).Plugin rendering has had a significant change, which is you should no longer use
file.content
to read and update the current document's content. Instead a new argument calledcontent
wil be passed, and it should be written to as well. This is a breaking change, and all renderers must be updated to facilitate this change. To learn the new way, then check out the Extending DocPad wiki page.When an error occurs, the error will now be sent back to DocPad using the AirBrake service. If you would like this disabled then you can turn it off by setting
reportErrors
tofalse
in your DocPad configuration.A lot of unstable or less-popular plugins have been moved out to the new docpad-extras repository. The plugins moved are:
admin
,authenticate
,autoupdate
,buildr
,html2jade
,move
,php
,rest
,roy
, andruby
. If you would like to continue using them, you will have to download them manually from thedocpad-extras
repository and insert them into your website'splugins
directory.
Upgrading from 2.x to 3.x
A lot of property names of the
File
class have changed. TheFile
class is used for all documents and layouts, which would likely affect you when rendering properties from documents inside your templates e.g.@document.title
. This change was made to better correlate the names with their values (before the correlation was quite ambiguous). You can find the current set of properties and their descriptions here.For plugin developers, the way you extend from the
BasePlugin
, and the way youmodule.exports
your plugin has changed. To learn about the new convention, refer to the new Extending guide by clicking here.For those using DocPad as a module, DocPad now supports a
next
callback on its constructor, allowing you to donew DocPad(config,next)
. Anything that depends on a DocPad action being completed should go inside thenext
callback. While this is optional, it has proven helpful in eliminating timing problems.
Upgrading from 1.x to 2.x
CoffeeScript v1.1.2 does not work with Node 0.5 or 0.6, you have to use v1.1.3 or higher. To do this, re-install CoffeeScript with
npm install -g coffee-script
For plugin developers:
Plugins have been revised to become more future proof and configurable. Plugins must be in their own directory, with the following format:
plugins/${pluginName}/${pluginName}.plugin.coffee
Plugin dependencies should no longer be in the DocPad's or your project's
package.json
file, but instead in their plugin directory'spackage.json
(e.g.,plugins/${pluginName}/package.json
); this file is optional, but recommended.If a plugin's
package.json
exists, as well as itsmain
property, DocPad will use that as the plugin file's location instead of the location in step 2.1.Plugin configuration should be moved to their
package.json
file, to the keydocpad.plugin
which should be an object. This is then customisable by DocPad'spackage.json
as well as the website's viadocpad.plugin.#{pluginName}
. The configuration of a plugin is available via the@config
property.To access DocPad within a plugin, you should now use
@docpad
rather than having it passed through as an argument, this applies for logger too (now use@logger
).A lot of DocPad configuration has been moved to
@docpad.config
The Bootstrap Skeleton is now the Kitchensink Skeleton
Upgrading from 0.x to 1.x
Install DocPad with the new global dependencies
npm install -g coffee-script docpad
Any of your
documents
orlayouts
which use the eco templating engine should have the extension.eco
appended (e.g.,layouts/default.html
tolayouts/default.html.eco
)Any of your
documents
orlayouts
which utilise a markup language should have the extension.html
prepended (e.g.,documents/something-in-markdown.md
todocuments/something-in-markdown.html.md
)These changes allow for some new incredibly powerful possibilities, such as allowing other templating engines other than eco, and allowing for multiple and more explicit markups to be applied to the files.
Last updated