Closed mr-moon closed 10 years ago
Make sure you have brackets after the haml:
definition and commas after each item in the files
directive`.
Your config should look like this:
haml: {
files: [{
expand: true,
src: ['server/app/views/*.haml'],
dest: 'build/app/views',
ext: '.php'
}]
}
Actually, i'm using coffeescript for my gruntfile. And the block I've initially included compiles correctly with all enclosed brackets. So this is absolutely not the case.
Just made a gruntfile.js, same result.
grunt --force haml --verbose --debug
Initializing
Command-line options: --force, --verbose, --debug=1
Reading "gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Registering "grunt-contrib-copy" local Npm module tasks.
Reading ~/App/node_modules/grunt-contrib-copy/package.json...OK
Parsing ~/App/node_modules/grunt-contrib-copy/package.json...OK
Loading "copy.js" tasks...OK
+ copy
Registering "grunt-contrib-watch" local Npm module tasks.
Reading ~/App/node_modules/grunt-contrib-watch/package.json...OK
Parsing ~/App/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Registering "grunt-contrib-concat" local Npm module tasks.
Reading ~/App/node_modules/grunt-contrib-concat/package.json...OK
Parsing ~/App/node_modules/grunt-contrib-concat/package.json...OK
Loading "concat.js" tasks...OK
+ concat
Registering "grunt-contrib-sass" local Npm module tasks.
Reading ~/App/node_modules/grunt-contrib-sass/package.json...OK
Parsing ~/App/node_modules/grunt-contrib-sass/package.json...OK
Loading "sass.js" tasks...OK
+ sass
Registering "grunt-haml-php" local Npm module tasks.
Reading ~/App/node_modules/grunt-haml-php/package.json...OK
Parsing ~/App/node_modules/grunt-haml-php/package.json...OK
Loading "haml.js" tasks...OK
+ haml
Initializing config...OK
Loading "gruntfile.js" tasks...OK
+ default
Running tasks: haml
Running "haml" task
[D] Task source: ~/App/node_modules/grunt-haml-php/tasks/haml.js
Running "haml:files" (haml) task
[D] Task source: ~/App/node_modules/grunt-haml-php/tasks/haml.js
Verifying property haml.files exists in config...OK
Warning: Object #<Object> has no method 'indexOf' Used --force, continuing.
Done, but with warnings.
Note the Reading "gruntfile.js" Gruntfile...OK
line.
Ah, sorry. I should have recognized that was coffeescript.
Can you try running grunt with the --stack
flag? You may need to drop the --force
flag in order to output the stack trace.
Thanks.
Great. Weren't aware of --stack
option. Here's the output:
grunt haml --stack
Running "haml:files" (haml) task
Warning: Object #<Object> has no method 'indexOf' Use --force to continue.
TypeError: Object #<Object> has no method 'indexOf'
at ~/App/node_modules/grunt/lib/grunt/file.js:55:29
at Array.forEach (native)
at processPatterns (~/App/node_modules/grunt/lib/grunt/file.js:53:34)
at Object.file.expand (~/App/node_modules/grunt/lib/grunt/file.js:110:17)
at Object.fn [as src] (~/App/node_modules/grunt/lib/grunt/task.js:180:36)
at removeInvalidFiles (~/App/node_modules/grunt-haml-php/tasks/haml.js:56:17)
at ~/App/node_modules/grunt-haml-php/tasks/haml.js:30:24
at ~/App/node_modules/grunt-haml-php/node_modules/async/lib/async.js:108:13
at Array.forEach (native)
at _each (~/App/node_modules/grunt-haml-php/node_modules/async/lib/async.js:32:24)
That error is being thrown down in the internals of Grunt, and I'm unable to come up with something that can reproduce it.
Would it be possible for you to publish a sample test case that exhibits this issue, along with what version of grunt and node you're using?
npm 1.3.14
grunt-cli v0.1.11
grunt v0.4.2
But the test case - is actually no files at all. Tried with 1 file just 1 simple code like <strong><%= item.title %></strong>
, but all was the same.
And I'm on OS X Mavericks.
Hi, try this... I had the same problem, but with this code it works ;)
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
haml: {
basic_html: {
files: [{
expand: true,
cwd: 'src/templates',
src: ['**/*.haml'],
dest: 'dest/',
ext: '.phtml'
}],
},
},
})
grunt.loadNpmTasks('grunt-haml-php');
};
Hey, had the same issue and your solution worked @Ceda. So basically it has to do with adding and extra level in the hierarchy. This works:
haml: {
compile: {
files: [{
expand: true,
src: ['*.haml'],
dest: 'dest/',
ext: '.php'
}],
},
},
And this doesn't work (gives the error OP posted)
haml: {
files: [{
expand: true,
src: ['*.haml'],
dest: 'dest/',
ext: '.php'
}]
},
Using pretty much copy/pasted grunt config:
But cannot avoid getting this error.
The
--force
doesn't have any effect.And here's the verbose log: