Browse files

support this.file api

  • Loading branch information...
tkellen committed Nov 13, 2012
1 parent caa3e09 commit fba326c33d314614c1439860c009f8a5edf8edae
Showing with 23 additions and 112 deletions.
  1. +1 −73
  2. +13 −23
  3. +9 −16 tasks/jade.js
@@ -1,73 +1 @@
-[Grunt homepage]( | [Documentation table of contents](
-# Contributing to grunt
-There are a number of grunt projects.
-* [grunt]( - the main grunt project
-* []( - the website
-* [grunt-contrib collection]( - a collection of all grunt "contrib" plugins
-In addition, each individual grunt-contrib plugin is a separate repository listed on the [gruntjs org homepage](
-## Filing issues
-If something isn't working like you think it should, please read the documentation first. If you'd like to chat with someone, [pop into IRC](#discussing-grunt) and ask your question there.
-The best way to ensure an issue gets addressed is to file it in the appropriate issues tracker.
-**If there's an issue with a specific grunt-contrib plugin:**
-Please file an issue on that plugin's issues tracker.
-**If you'd like to contribute a new plugin:**
-Please file an issue on the [grunt-contrib collection issues tracker]( We don't accept all plugins, but we'll certainly consider yours.
-**If there's an issue with the [website](**
-Please file an issue on the [ website issues tracker](
-**If there's an issue that isn't specific to any of the above:**
-Please file an issue on the [grunt issues tracker](
-### Simplify the issue
-Try to [reduce your code]( to the bare minimum required to reproduce the issue. This makes it much easier (and much faster) to isolate and fix the issue.
-### Explain the issue
-If we can't reproduce the issue, we can't fix it. Please list the exact steps required to reproduce the issue. Include versions of your OS, Node.js, grunt, etc. Include relevant logs or sample code.
-## Discussing grunt
-Join the [freenode]( IRC #grunt channel. We've got a bot and everything.
-_No private messages, please._
-## Modifying grunt
-First, ensure that you have the latest [Node.js]( and [npm]( installed.
-1. Fork and clone the repo.
-1. Check out the correct branch. Currently, grunt development happens in the `devel` branch.
-1. Run `npm install` to install all grunt dependencies.
-1. Run `npm link` to put the dev version of grunt in the system path (this is only needed for developing grunt, not for plugins or the website).
-1. Run `grunt` to grunt grunt.
-Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing breaks.
-### Submitting pull requests
-1. Create a new branch, please don't work in your `master` or `devel` branch directly.
-1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail.
-1. Fix stuff.
-1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done.
-1. Update the documentation to reflect any changes.
-1. Push to your fork and submit a pull request.
-### Syntax
-* Two space indents. Don't use tabs anywhere. Use `\t` if you need a tab character in a string.
-* No trailing whitespace, except in markdown files where a linebreak must be forced.
-* Don't go overboard with the whitespace.
-* No more than [one assignment]( per `var` statement.
-* Delimit strings with single-quotes `'`, not double-quotes `"`.
-* Prefer `if` and `else` to ["clever"]( uses of `? :` conditional or `||`, `&&` logical operators.
-* Comments are great. Just put them _before_ the line of code, _not_ at the _end_ of the line.
-* **When in doubt, follow the conventions you see used in the source already.**
-### Reverting back to the "official" grunt
-If you've used `npm link` to put a dev version of grunt in the system path and, for some reason, need to revert back to the current official grunt release, just reinstall grunt globally with `npm install -g grunt`
+Please see the [Contributing to grunt]( guide for information on contributing to this project.
@@ -2,31 +2,20 @@
> Compile Jade files to HTML.
-_Note that this plugin has not yet been released, and only works with the latest bleeding-edge, in-development version of grunt. See the [When will I be able to use in-development feature 'X'?]( FAQ entry for more information._
## Getting Started
-_If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide._
+If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide, as it explains how to create a [gruntfile][Getting Started] as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:
-From the same directory as your project's [Gruntfile][Getting Started] and [package.json][], install this plugin with the following command:
npm install grunt-contrib-jade --save-dev
-Once that's done, add this line to your project's Gruntfile:
-If the plugin has been installed correctly, running `grunt --help` at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a `devDependency`, which ensures that it will be installed whenever the `npm install` command is run.
[Getting Started]:
-## The jade task
+## Jade task
+_Run this task with the `grunt jade` command._
### Overview
@@ -46,7 +35,7 @@ grunt.initConfig({
### Options
-## files
+#### files
Type: `Object`
This defines what files this task will process and should contain key:value pairs.
@@ -55,7 +44,7 @@ The key (destination) should be an unique filepath (supports [grunt.template](ht
Note: When the value contains an array of multiple filepaths, the contents are concatenated in the order passed.
Type: `Object`
Sets the data passed to `jade` during template compilation. Any data can be passed to the template (including `grunt` templates).
@@ -141,11 +130,12 @@ jade: {
## Release History
- * 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.
+ * 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.
-Task submitted by <a href="">Eric Woroshow</a>.
+Task submitted by [Eric Woroshow](
-*Generated on Thu Oct 18 2012 19:03:21.*
+*This file was generated on Tue Nov 13 2012 16:08:56.*
@@ -11,29 +11,22 @@
module.exports = function(grunt) {
grunt.registerMultiTask('jade', 'Compile Jade templates into HTML.', function() {
- var srcFiles, taskOutput;
var helpers = require('grunt-lib-contrib').init(grunt);
var options = this.options({
data: {}
grunt.verbose.writeflags(options, 'Options');
- this.files.forEach(function(file) {
- srcFiles = grunt.file.expandFiles(file.src);
- taskOutput = [];
- srcFiles.forEach(function(srcFile) {
- taskOutput.push(compileJade(srcFile, options,;
- });
- if (taskOutput.length > 0) {
- grunt.file.write(file.dest, taskOutput.join('\n'));
- grunt.log.writeln('File ' + file.dest.cyan + ' created.');
- }
+ var files = grunt.file.expandFiles(this.file.src);
+ var taskOutput = {
+ return compileJade(file, options,;
+ if (taskOutput.length > 0) {
+ grunt.file.write(this.file.dest, taskOutput.join('\n'));
+ grunt.log.writeln('File ' + this.file.dest.cyan + ' created.');
+ }
var compileJade = function(srcFile, options, data) {
@@ -49,4 +42,4 @@ module.exports = function(grunt) {'Jade failed to compile.');

0 comments on commit fba326c

Please sign in to comment.