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

Support for passing options into `exec' #38

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
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ HAML file will be passed as the last command-line argument.

*Defined only for language == 'ruby'

#### execOptions
Type: ```object```
Default: ```{}```

Allows passing options into calls made to exec.

#### includePath
Type: ```boolean```
Default: ```false```
Expand Down Expand Up @@ -237,7 +243,8 @@ haml: {


## Release History


* 2015-11-20 v0.9.1 Support passing options into calls to exec.
* 2013-10-09   v0.8.0   Update version of haml-coffee 1.13.x Rendering to HTML with partials now works correctly
* 2013-08-21   v0.7.0   Replace execSync with proper use of exec.
* 2013-08-11   v0.6.1   Update version of haml-coffee 1.11.x
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grunt-haml",
"description": "Process HAML templates to precompiled JavaScript or rendered HTML.",
"version": "0.9.0",
"version": "0.9.1",
"homepage": "https://github.com/concordusapps/grunt-haml",
"author": {
"name": "Concordus Applications"
Expand Down
5 changes: 4 additions & 1 deletion tasks/haml.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ module.exports = function(grunt) {
// External haml command to execute, must accept STDIN
rubyHamlCommand: 'haml -t ugly',

// Options passed into calls to exec
execOptions: {},

// Precompile templates; if false (and target == 'js'), place rendered
// HTML in js variables.
precompile: true
Expand Down Expand Up @@ -253,7 +256,7 @@ module.exports = function(grunt) {

var p = path.resolve(options.filename);
var command = options.rubyHamlCommand + ' ' + p;
var result = exec(command, function(error, stdout, stderr) {
var result = exec(command, options.execOptions, function(error, stdout, stderr) {
if (result.error || error) {
grunt.fail.warn(
"Error executing haml on " + p + ": \n" +
Expand Down