asciidisco / grunt-imagine

Grunt tasks for optimizing & inlining images
MIT License
153 stars 21 forks source link

Error processing a template #16

Closed stuartf closed 12 years ago

stuartf commented 12 years ago

When running grunt inlineImg I get this output:

Running "inlineImg" task
<WARN> An error occurred while processing a template (Cannot call method 'indexOf' of undefined). Use --force to continue. </WARN>

Aborted due to warnings.

My config for that task just looks like:

inlineImg: {
  shared: {
    src: [ 'shared/**/*.css' ],
    dest: 'target/optimized/shared/',
    ie8: true,
    base: __dirname
  }
}

So I don't think I'm introducing any templates, but I'm unable to find any in the grunt-imagine source either, so now I'm confused.

stuartf commented 12 years ago

I patched grunt to make it dump a stack trace on template errors (https://github.com/gruntjs/grunt/pull/533) and got out this:

TypeError: Cannot call method 'indexOf' of undefined
    at Object.template.process (/home/stuart/src/3akai-ux/node_modules/grunt/lib/grunt/template.js:69:21)
    at file.expand (/home/stuart/src/3akai-ux/node_modules/grunt/lib/grunt/file.js:54:30)
    at Array.map (native)
    at Function._.map (/home/stuart/src/3akai-ux/node_modules/grunt/node_modules/underscore/underscore.js:100:56)
    at wrapper.(anonymous function) [as map] (/home/stuart/src/3akai-ux/node_modules/grunt/node_modules/underscore/underscore.js:957:26)
    at Object.file.expand (/home/stuart/src/3akai-ux/node_modules/grunt/lib/grunt/file.js:52:52)
    at Object.expandByType (/home/stuart/src/3akai-ux/node_modules/grunt/lib/grunt/file.js:69:22)
    at Object.module.exports (/home/stuart/src/3akai-ux/node_modules/grunt-imagine/tasks/inlineImg.js:10:28)
    at Object.task.registerTask.thisTask.fn (/home/stuart/src/3akai-ux/node_modules/grunt/lib/grunt/task.js:58:16)
    at Task.<anonymous> (/home/stuart/src/3akai-ux/node_modules/grunt/lib/util/task.js:343:36)

Which seems to be a problem with grunt.file.expandFiles(config.src).

And now I see the problem with my config, this isn't a multi-task :hurtrealbad:

asciidisco commented 11 years ago

You can try the bleeding edge master branch from github, you can then use the multi-task feature.