alexluke / grunt-haml-php

Process HAML templates using MtHaml, a PHP port of Haml.
MIT License
9 stars 8 forks source link

Simple File Mapping Not Working #11

Open manishie opened 10 years ago

manishie commented 10 years ago

Hi,

(Thanks for the plugin!).

I want to use grunt-newer, and it seems to only work with simple file mapping. So in grunt-haml-php I'm trying to get that setup. If I follow your example:

haml: {
  files: {
    'templates/head.php': ['assets/haml/head.haml'],
  }
}

the task won't run. Adding in an extra level to the hierarchy (per one of the other comments) sort of works:

haml: {
  compile: {
    files: {
      'templates/head.php': ['assets/haml/head.haml'],
    }
  }
}

The task runs, but the file names come out wrong:

Running "haml:compile" (haml) task
File templates/head.phphead.php created.

So the filename gets duplicated. Any ideas?

Thanks!

alexluke commented 10 years ago

You're right about the example in the documentation. I've updated it to reflect reality.

I'm not sure what's causing the filename issue, but I've used grunt-newer with the expanded file mapping without problems.

watch: {
  haml: {
    files: ['<%= config.theme.source %>/templates/**/*.haml'],
    tasks: ['newer:haml:main'],
  }
},
haml: {
  main: {
    files: [{
      expand: true,
      cwd: '<%= config.theme.source %>',
      dest: '<%= config.theme.output %>',
      src: ['templates/*.haml'],
      ext: '.php',
    }
  }
}