Releases: sintaxi/harp
200.xxx, _data, _contents, css error messages
Overview
- adds
200.xxx
fallback feature that behaves the same as custom 404 pages except returns status code 200 instead. - changes
data
to_data
in public object. - changes
contents
to_contents
in public object.
Fixes
- css error messages now returns 200 status code so the error will show up in main html file.
Preprocessor updates
- LESS updated to v1.5.0
- Stylus updated to v0.40.0
API Breakage
A very common API has change. The change is low risk but will break a lot of apps. All instances of data
in the public
object now begins with underscore. Its now _data
. The same change is made for the less commonly used contents
arrays. Now _contents
.
ignore dot dirs
small release where harp ignores hidden directories. that is all.
Windows Support
Overview
- now works on windows (tested on windows 8)
- minor layout rendering fix (Zhang Yichao)
- rewrote 404 fallback codepath
- simplified error pages
- many bug fixes
Preprocessor updates
- jade updated to v0.35.0
- less updated to v1.4.2
- stylus updated to v0.38.0
- marked updated to v0.2.9
API Breakage
- Jade made a small change
script
andstyle
tags must be changed toscript.
andstyle.
- Less also had minor API breakage see v1.4.2 release notes
mountable apps
As of this release, Harp apps are now mountable. This makes it trivial to tack a blog or whatever onto an express/connect server.
API
harp.mount(mountPoint*, harpPath)
if you would like to mount an application at the "/docs" route just add that as your mountPoint
var docsPath = __dirname + "/docs"
app.use(harp.mount("/docs", docsPath))
The mountPath is optional. If you would like to use harp as your asset pipeline, just omit the mountPath and point it to your harp app....
app.use(harp.mount(__dirname + "/public"))
Cascading Layouts
Layout engine got a pretty major overhaul
1) Cascading Layout lookup
Layouts walk the directory tree by default looking for _layout.xxx
in each directory until it hits the public directory. (specifying a layout file in _data.json) will be how you override this behaviour.
2) Overrides are a relative path to the template file (or _data.json)
Specifying a layout in _data.json
is how to override the implicit layout behaviour and this file path should be relative to the template file. This makes sense because the _data.json
file lives where the template file lives. The system falls back to using an absolute path if no layout is found at the relative path specified. This is to make it easier to accidentally do the right thing.
3) Layout file opt-out.
Specifying a "layout": false
in the _data.json
does not use a layout file and "layout": true
works just like the default behaviour.
How to Upgrade
Zero to minimal API breakage expected. Upgrade by running the following...
sudo npm install harp -g
Restart your harp webserver and your good to go.
quickfix for static serving
There was a small bug found in the static serving of "root style" projects. This patch fixes that.
Root Serving and Globals (API Change)
important - there were changes to the globals
object. skip to bottom for upgrade path.
Disposable web serving.
Harp now works as a great little disposable web server for serving assets in a hurry. To use simply run harp server
in the root of any directory that you want served. You may also create a _harp.json
file in the root of your project for addition configuration.
The framework style directory structure still functions as usual but now requires a harp.json
file in the root directory. When a harp.json
file (no underscore) is found, it tells the server to serve a public directory instead of the root.
How global
objects now work.
You put your globals in harp.json
file as you did before...
{
"globals": {
"title": "Sintaxi Blog"
}
}
and now you can reference then as first class attributes in all your templates...
h1= title
Breakdown of our planned API breakage (marked tasks are completed):
- make
globals
truely global - server default to serve root
- make templates look up the tree for the nearest
_layout.xxx
- make layout overrides relative paths
- replace EJS with handlebars
Upgrade Path
- run
sudo npm install -g harp
and restart your servernode server
. - remove
globals
scope form all references to the global variables in your app. For exampleglobals.name
is now referenced as justname
. Andglobals.public.data
is referenced aspublic.data
. - add a
harp.json
file to your project if you want to keep your current application running the same way.