Switching to this.files property per gruntjs/grunt#606.

format
Kyle Robinson Young 12 years ago
parent 56edaf6b95
commit f6d67bca77

@ -1,3 +1,8 @@
v0.4.0rc5:
date: 2013-01-09
changes:
- Updating to work with grunt v0.4.0rc5.
- Switching to this.files api.
v0.3.1:
date: 2012-10-12
changes:

@ -1,71 +1 @@
# Contributing to grunt
There are a number of grunt projects.
* [grunt](https://github.com/gruntjs/grunt) - the main grunt project
* [gruntjs.com](https://github.com/gruntjs/gruntjs.com) - the gruntjs.com website
* [grunt-contrib collection](https://github.com/gruntjs/grunt-contrib) - a collection of all grunt "contrib" plugins
In addition, each individual grunt-contrib plugin is a separate repository listed on the [gruntjs org homepage](https://github.com/gruntjs).
## 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](https://github.com/gruntjs/grunt-contrib/issues). We don't accept all plugins, but we'll certainly consider yours.
**If there's an issue with the [website](http://gruntjs.com/):**
Please file an issue on the [gruntjs.com website issues tracker](https://github.com/gruntjs/gruntjs.com/issues).
**If there's an issue that isn't specific to any of the above:**
Please file an issue on the [grunt issues tracker](https://github.com/gruntjs/grunt/issues).
### Simplify the issue
Try to [reduce your code](http://www.webkit.org/quality/reduction.html) 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](http://freenode.net/) 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](http://nodejs.org/) and [npm](http://npmjs.org/) 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](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) per `var` statement.
* Delimit strings with single-quotes `'`, not double-quotes `"`.
* Prefer `if` and `else` to ["clever"](http://programmers.stackexchange.com/a/25281) 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-cli`
Please see the [Contributing to grunt](http://gruntjs.com/contributing) guide for information on contributing to this project.

@ -21,6 +21,8 @@ _This task is a [multi task][] so any targets, files and options should be speci
[multi task]: https://github.com/gruntjs/grunt/wiki/Configuring-tasks
_Version `0.4.x` of this plugin is compatible with Grunt `0.4.x`. Version `0.3.x` of this plugin is compatible with Grunt `0.3.x`._
### Options
#### namespace
@ -135,14 +137,15 @@ jst: {
## Release History
* 2012-10-12v0.3.1Rename grunt-contrib-lib dep to grunt-lib-contrib.
* 2012-08-23v0.3.0Options no longer accepted from global config key.
* 2012-08-16v0.2.3Support for nested namespaces.
* 2012-08-12v0.2.2Added processName functionality & escaping single quotes in filenames.
* 2012-08-10v0.2.0Refactored from grunt-contrib into individual repo.
* 2013-01-08v0.4.0rc5Updating to work with grunt v0.4.0rc5. Switching to this.filesSrc api.
* 2012-10-11v0.3.1Rename grunt-contrib-lib dep to grunt-lib-contrib.
* 2012-08-22v0.3.0Options no longer accepted from global config key.
* 2012-08-15v0.2.3Support for nested namespaces.
* 2012-08-11v0.2.2Added processName functionality & escaping single quotes in filenames.
* 2012-08-09v0.2.0Refactored from grunt-contrib into individual repo.
---
Task submitted by [Tim Branyen](http://tbranyen.com)
*This file was generated on Sat Dec 29 2012 22:17:11.*
*This file was generated on Wed Jan 09 2013 14:42:32.*

@ -1 +1,3 @@
{%= s.multi_task %}
_Version `0.4.x` of this plugin is compatible with Grunt `0.4.x`. Version `0.3.x` of this plugin is compatible with Grunt `0.3.x`._

@ -1,7 +1,7 @@
{
"name": "grunt-contrib-jst",
"description": "Precompile Underscore templates to JST file.",
"version": "0.3.1",
"version": "0.4.0rc5",
"homepage": "https://github.com/gruntjs/grunt-contrib-jst",
"author": {
"name": "Grunt Team",
@ -20,7 +20,7 @@
"url": "https://github.com/gruntjs/grunt-contrib-jst/blob/master/LICENSE-MIT"
}
],
"main": "grunt.js",
"main": "Gruntfile.js",
"engines": {
"node": ">= 0.8.0"
},
@ -32,11 +32,11 @@
"grunt-lib-contrib": "~0.3.0"
},
"devDependencies": {
"grunt-contrib-jshint": "~0.1.0",
"grunt-contrib-nodeunit": "~0.1.0",
"grunt-contrib-internal": "~0.1.0",
"grunt-contrib-clean": "~0.4.0",
"grunt": "~0.4.0"
"grunt-contrib-jshint": "~0.1.1rc5",
"grunt-contrib-nodeunit": "~0.1.2rc5",
"grunt-contrib-internal": "*",
"grunt-contrib-clean": "~0.4.0rc5",
"grunt": "~0.4.0rc5"
},
"keywords": [
"gruntplugin"

@ -29,42 +29,43 @@ module.exports = function(grunt) {
grunt.verbose.writeflags(options, 'Options');
var compiled, src, filename;
var compiled, src, filename, output;
var nsInfo = helpers.getNamespaceDeclaration(options.namespace);
var files = this.file.src;
var output = files.map(function(file) {
var src = options.processContent(grunt.file.read(file));
this.files.forEach(function(f) {
output = f.src.map(function(file) {
src = options.processContent(grunt.file.read(file));
try {
compiled = _.template(src, false, options.templateSettings).source;
} catch (e) {
grunt.log.error(e);
grunt.fail.warn('JST failed to compile.');
}
try {
compiled = _.template(src, false, options.templateSettings).source;
} catch (e) {
grunt.log.error(e);
grunt.fail.warn('JST failed to compile.');
}
if (options.prettify) {
compiled = compiled.replace(/\n+/g, '');
}
filename = processName(file);
if (options.prettify) {
compiled = compiled.replace(/\n+/g, '');
}
filename = processName(file);
return nsInfo.namespace+'['+JSON.stringify(filename)+'] = '+compiled+';';
});
return nsInfo.namespace+'['+JSON.stringify(filename)+'] = '+compiled+';';
});
if(output.length > 0) {
output.unshift(nsInfo.declaration);
if (options.amdWrapper) {
if (options.prettify) {
output.forEach(function(line, index) {
output[index] = " " + line;
});
if (output.length > 0) {
output.unshift(nsInfo.declaration);
if (options.amdWrapper) {
if (options.prettify) {
output.forEach(function(line, index) {
output[index] = " " + line;
});
}
output.unshift("define(function(){");
output.push(" return " + nsInfo.namespace + ";\n});");
}
output.unshift("define(function(){");
output.push(" return " + nsInfo.namespace + ";\n});");
grunt.file.write(f.dest, output.join('\n\n'));
grunt.log.writeln('File "' + f.dest + '" created.');
}
grunt.file.write(this.file.dest, output.join('\n\n'));
grunt.log.writeln('File "' + this.file.dest + '" created.');
}
});
});
};

Loading…
Cancel
Save