Comparing version 0.4.12 to 0.5.0
@@ -407,4 +407,4 @@ | ||
* eg. | ||
* foo.jade => foo.html | ||
* foo.html.jade => foo.html | ||
* foo.jade => html | ||
* foo.html.jade => html | ||
*/ | ||
@@ -477,3 +477,3 @@ | ||
* | ||
* returns true if file is a pre-processor stylsheet file | ||
* returns true if file is a pre-processor stylesheet file | ||
* | ||
@@ -497,3 +497,3 @@ * eg. | ||
* | ||
* returns true if file is a pre-processor stylsheet file | ||
* returns true if file is a pre-processor javascript file | ||
* | ||
@@ -500,0 +500,0 @@ * eg. |
@@ -58,3 +58,3 @@ | ||
var partialCurrent = helpers.getCurrent(relPath) | ||
var templateLocals = helpers.walkData(partialCurrent.path, partentLocals.globals.public) | ||
var templateLocals = helpers.walkData(partialCurrent.path, partentLocals.public) | ||
var fileContents = fs.readFileSync(filePath) | ||
@@ -61,0 +61,0 @@ var ext = path.extname(relPath).replace(/^\./, '') |
@@ -39,6 +39,6 @@ var fs = require('fs') | ||
var templateObject = { globals: { public: data } } | ||
var templateObject = { public: data } | ||
for(var key in globals){ | ||
templateObject['globals'][key] = globals[key] | ||
templateObject[key] = globals[key] | ||
} | ||
@@ -45,0 +45,0 @@ |
{ | ||
"name": "terraform", | ||
"version": "0.4.12", | ||
"version": "0.5.0", | ||
"description": "Foolproof Asset Pipeline used in the Harp", | ||
@@ -10,2 +10,6 @@ "main": "./lib/terraform", | ||
"author": "Brock Whitten <brock@chloi.io>", | ||
"contributors": [ | ||
{ "name": "Brock Whitten", "email": "brock@chloi.io" }, | ||
{ "name": "Brian Donovan", "email": "donovan@squareup.com" } | ||
], | ||
"license": "MIT", | ||
@@ -12,0 +16,0 @@ "dependencies": { |
# terraform | ||
Foolproof Asset Pipeline used in the Harp APF. | ||
> Terraform is the pre-processor engine for the Harp Web Server. Terraform does not write or serve files. Ony processes. | ||
## Features | ||
- pre-processorse | ||
- layouts | ||
- partials | ||
- metadata (via _data.json) | ||
- LRU cache (production mode) | ||
### Supported Pre-Processors | ||
**HTML** - EJS, Jade, Markdown | ||
**CSS** - LESS, Stylus | ||
**JavaScript** - CoffeeScript | ||
 | ||
@@ -11,11 +25,28 @@ | ||
## Usage | ||
## API | ||
var terraform = require('terraform') | ||
var planet = terraform.root('path/to/project') | ||
planet.render('index.jade', function(error, body){ | ||
console.log(body) | ||
}) | ||
Step 1) require the library | ||
```javascript | ||
var terraform = require('terraform') | ||
``` | ||
Step 2) set the root | ||
- publicPath (String): path to public directory | ||
- globals (Object): global variables to be available to every template | ||
```javascript | ||
var planet = root("path/to/public/dir", { "title": "Bitchin" }) | ||
``` | ||
Step 3) render a file | ||
```javascript | ||
planet.render('index.jade', function(error, body){ | ||
console.log(body) | ||
}) | ||
``` | ||
## Tests | ||
@@ -22,0 +53,0 @@ |
27260
56