derby-jade
Advanced tools
Comparing version 0.6.4 to 0.6.6
var jade = require('./index'); | ||
var options = {}; | ||
var jadeCompiler = function(file, filename, options) { | ||
options || (options = {}); | ||
var jadeCompiler = function(file, filename) { | ||
var out; | ||
@@ -13,5 +13,6 @@ jade.renderFile(filename, options, function(err, html) { | ||
module.exports = function(app) { | ||
module.exports = function(app, opts) { | ||
if (opts) options = opts; | ||
app.viewExtensions.push('.jade'); | ||
app.compilers['.jade'] = jadeCompiler; | ||
}; |
@@ -7,2 +7,3 @@ /*! | ||
var coffee = require('./coffee'); | ||
var utils = require('./utils'); | ||
@@ -24,3 +25,5 @@ | ||
options = options || {}; | ||
this.coffee = options.coffee; | ||
this.input = str.replace(/\r\n|\r/g, '\n'); | ||
if (this.coffee) this.input = coffee.compileInput(this.input); | ||
this.colons = options.colons; | ||
@@ -431,2 +434,4 @@ this.deferredTokens = []; | ||
, js = captures[2]; | ||
if (this.coffee) js = coffee.compile(js); | ||
// Quickfix for single quotes - replace all occurances of ' with " | ||
@@ -571,2 +576,3 @@ js = js.replace(/'/g, '"'); | ||
tok.escaped[key] = escapedAttr; | ||
if (this.coffee && coffee.isEvent(key)) val = coffee.compileAttr(val); | ||
tok.attrs[key] = '' == val | ||
@@ -573,0 +579,0 @@ ? true |
{ | ||
"name": "derby-jade", | ||
"description": "Jade for Derby.js", | ||
"version": "0.6.4", | ||
"version": "0.6.6", | ||
"author": { | ||
@@ -11,6 +11,6 @@ "name": "Pavel Zhukov", | ||
"type": "git", | ||
"url": "git://github.com/cray0000/derby-jade.git" | ||
"url": "git://github.com/derbyparty/derby-jade.git" | ||
}, | ||
"bugs": { | ||
"url": "git://github.com/cray0000/derby-jade/issues" | ||
"url": "git://github.com/derbyparty/derby-jade/issues" | ||
}, | ||
@@ -25,6 +25,6 @@ "main": "./derby_adapter.js", | ||
"mkdirp": "0.3.x", | ||
"transformers": "~1.8.0" | ||
"transformers": "~1.8.0", | ||
"coffee-script": "~1.7.1" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "*", | ||
"mocha": "*", | ||
@@ -31,0 +31,0 @@ "markdown": "*", |
@@ -19,2 +19,17 @@ # Jade static compiler for Derby.js | ||
## Coffeescript | ||
If you want to use Coffeescript instead of Javascript in templates: | ||
```js | ||
// Add Jade compilation support | ||
app.serverUse(module, 'derby-jade', {coffee: true}); | ||
``` | ||
Then you can do something like this: | ||
```html | ||
if a and b | ||
p | ||
a(on-click="console.log c or 'log'") {{d or 'Click Me'}} | ||
``` | ||
## Derby.js-specific syntax | ||
@@ -21,0 +36,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
450908
7
55
6282
130
4
+ Addedcoffee-script@~1.7.1
+ Addedcoffee-script@1.7.1(transitive)