Socket
Socket
Sign inDemoInstall

grunt-contrib-jade

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-contrib-jade - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

test/expected/jadeDynamicData.html

54

docs/jade-options.md

@@ -5,3 +5,3 @@ # Options

Type: `Boolean`
Default: false
Default: **false**

@@ -13,25 +13,42 @@ Output indented HTML.

Sets the data passed to `jade` during template compilation. Any data can be passed to the template (including `grunt` templates).
Sets the data passed to Jade during template compilation. Any data can be passed to the template (including grunt templates).
## comileDebug
This value also might be a function taking source and destination path as arguments and returning a data object. Within the function, `this` is bound to the file configuration object.
```js
options: {
data: function(dest, src) {
return {
from: src,
to: dest
};
}
}
```
## compileDebug
Type: `Boolean`
Default: **true**
Set `compileDebug: fase` to remove `jade` debug instructions in javascript templates.
Add Jade debug instructions to generated JS templates.
## client
Type: `Boolean`
Default: **false**
Compile to JS template functions for client-side use rather than directly to HTML.
## namespace
Type: `String` `false`
Default: 'JST'
Type: `String`, `Boolean`
Default: **JST**
The namespace in which the precompiled templates will be assigned. *Use dot notation (e.g. App.Templates) for nested namespaces or false for no namespace wrapping.* When false with `amd` option set `true`, templates will be returned directly from the AMD wrapper.
The namespace in which the precompiled templates will be assigned. Use dot notation (*e.g.* `App.Templates`) for nested namespaces or `false` for no namespace wrapping.
Example:
```js
options: {
namespace: 'MyApp.Templates'
}
```
When set to `false` with **amd** option set to `true`, the templates will be returned directly from the AMD wrapper.
## amd
Type: `Boolean`
default: `false`
Default: **false**

@@ -48,6 +65,9 @@ Wraps the output file with an AMD define function and returns the compiled template namespace unless namespace has been explicitly set to false in which case the template function will be returned directly.

## processName
Type: `function`
Type: `Function`
This option accepts a function which takes one argument (the template filepath) and returns a string which will be used as the key for the precompiled template object. The example below stores all templates on the default JST namespace in capital letters.
This option accepts a function which takes one argument (the template filepath) and returns a string which will be used as the key for the precompiled template object.
**Example**
Store all template on the default JST namespace in capital letters.
```js

@@ -59,2 +79,2 @@ options: {

}
```
```

@@ -83,2 +83,15 @@ /*

}
},
compile_dynamic_data: {
files: {
'tmp/jadeDynamicData.html': ['test/fixtures/jadeDynamicData.jade']
},
options: {
data: function(dest, src) {
return {
dest: dest,
src: src
};
}
}
}

@@ -85,0 +98,0 @@ },

{
"name": "grunt-contrib-jade",
"description": "Compile Jade files to HTML.",
"version": "0.5.0",
"description": "Compile Jade templates.",
"version": "0.5.1",
"homepage": "https://github.com/gruntjs/grunt-contrib-jade",

@@ -6,0 +6,0 @@ "author": {

@@ -1,4 +0,4 @@

# grunt-contrib-jade [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-jade.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-jade)
# grunt-contrib-jade [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-jade.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-jade)
> Compile Jade files to HTML.
> Compile Jade templates.

@@ -34,3 +34,3 @@

Type: `Boolean`
Default: false
Default: **false**

@@ -42,25 +42,42 @@ Output indented HTML.

Sets the data passed to `jade` during template compilation. Any data can be passed to the template (including `grunt` templates).
Sets the data passed to Jade during template compilation. Any data can be passed to the template (including grunt templates).
#### comileDebug
This value also might be a function taking source and destination path as arguments and returning a data object. Within the function, `this` is bound to the file configuration object.
```js
options: {
data: function(dest, src) {
return {
from: src,
to: dest
};
}
}
```
#### compileDebug
Type: `Boolean`
Default: **true**
Set `compileDebug: fase` to remove `jade` debug instructions in javascript templates.
Add Jade debug instructions to generated JS templates.
#### client
Type: `Boolean`
Default: **false**
Compile to JS template functions for client-side use rather than directly to HTML.
#### namespace
Type: `String` `false`
Default: 'JST'
Type: `String`, `Boolean`
Default: **JST**
The namespace in which the precompiled templates will be assigned. *Use dot notation (e.g. App.Templates) for nested namespaces or false for no namespace wrapping.* When false with `amd` option set `true`, templates will be returned directly from the AMD wrapper.
The namespace in which the precompiled templates will be assigned. Use dot notation (*e.g.* `App.Templates`) for nested namespaces or `false` for no namespace wrapping.
Example:
```js
options: {
namespace: 'MyApp.Templates'
}
```
When set to `false` with **amd** option set to `true`, the templates will be returned directly from the AMD wrapper.
#### amd
Type: `Boolean`
default: `false`
Default: **false**

@@ -77,6 +94,9 @@ Wraps the output file with an AMD define function and returns the compiled template namespace unless namespace has been explicitly set to false in which case the template function will be returned directly.

#### processName
Type: `function`
Type: `Function`
This option accepts a function which takes one argument (the template filepath) and returns a string which will be used as the key for the precompiled template object. The example below stores all templates on the default JST namespace in capital letters.
This option accepts a function which takes one argument (the template filepath) and returns a string which will be used as the key for the precompiled template object.
**Example**
Store all template on the default JST namespace in capital letters.
```js

@@ -89,2 +109,3 @@ options: {

```
### Usage Examples

@@ -173,9 +194,10 @@

* 2013-03-06   v0.5.0   Allow compilation to JS functions Support JST and AMD formats
* 2013-02-14   v0.4.0   First official release for Grunt 0.4.0.
* 2013-01-23   v0.4.0rc7   Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
* 2013-01-08   v0.4.0rc5   Updating to work with grunt v0.4.0rc5. Switching to this.files api.
* 2012-10-11   v0.3.1   Rename grunt-contrib-lib dep to grunt-lib-contrib.
* 2012-09-23   v0.3.0   Options no longer accepted from global config key.
* 2012-09-09   v0.2.0   Refactored from grunt-contrib into individual repo.
* 2013-05-06   v0.5.1   Allow options.data to be a function
* 2013-03-07   v0.5.0   Allow compilation to JS functions Support JST and AMD formats
* 2013-02-15   v0.4.0   First official release for Grunt 0.4.0.
* 2013-01-24   v0.4.0rc7   Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
* 2013-01-09   v0.4.0rc5   Updating to work with grunt v0.4.0rc5. Switching to this.files api.
* 2012-10-12   v0.3.1   Rename grunt-contrib-lib dep to grunt-lib-contrib.
* 2012-09-24   v0.3.0   Options no longer accepted from global config key.
* 2012-09-10   v0.2.0   Refactored from grunt-contrib into individual repo.

@@ -186,2 +208,2 @@ ---

*This file was generated on Thu Mar 07 2013 08:08:26.*
*This file was generated on Mon May 06 2013 22:39:17.*

@@ -67,3 +67,4 @@ /*

} else {
compiled = compiled(data);
// if data is function, bind to f.orig, passing f.dest and f.src
compiled = compiled(_.isFunction(data) ? data.call(f.orig, f.dest, f.src) : data);
}

@@ -70,0 +71,0 @@

@@ -7,3 +7,3 @@ var grunt = require('grunt');

test.expect(4);
test.expect(5);

@@ -26,4 +26,8 @@ var actual = grunt.file.read('tmp/jade.html');

actual = grunt.file.read('tmp/jadeDynamicData.html');
expected = grunt.file.read('test/expected/jadeDynamicData.html');
test.equal(expected, actual, 'should allow options.data to be a function');
test.done();
}
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc