Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add batchLimit option #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ window.HAML['templates/example']

*Defined only `placement == 'global'`.*

#### batchLimit
Type: ```number```
Default: ```20```

The maximum number of asynchronous transpiling processes simultaneously running at any time.

### Usage examples

``` javascript
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"node": "0.10.x"
},
"dependencies": {
"async": "^0.9.0",
"haml": "0.4.x",
"haml-coffee": "1.14.x"
},
Expand Down
9 changes: 6 additions & 3 deletions tasks/haml.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = function(grunt) {
'use strict';

var path = require('path');
var async = grunt.util.async;
var async = require('async');
var _ = grunt.util._;

grunt.registerMultiTask('haml', 'Compile Haml files', function() {
Expand Down Expand Up @@ -41,7 +41,10 @@ module.exports = function(grunt) {

// Precompile templates; if false (and target == 'js'), place rendered
// HTML in js variables.
precompile: true
precompile: true,

// The maximum number of asynchronous transpiling processes simultaneously running at any time
batchLimit: 20

});

Expand All @@ -52,7 +55,7 @@ module.exports = function(grunt) {
grunt.verbose.writeflags(options, 'Options');

// Transpile each src/dest group of files.
async.forEach(this.files, function(file, callback) {
async.eachLimit(this.files, options.batchLimit, function(file, callback) {
var opts;
// Get only files that are actually there.
var validFiles = file.src.filter(function(filepath) {
Expand Down