jwvdiermen/grunt-include-source

Does nothing

Closed this issue · 6 comments

Hi there!

First of all let me say that this is a wonderful idea and that's exactly what I'm looking for our project.
Unfortunately id does not work. Here I composed a test grunt setup with only one task and a setup from your documentation to illustrate just that:
https://github.com/dmitrybelyakov/grunt-include-source

I'll investigate further and post back if I find the issue.
Have a great day!

Thanks for your feedback. I still need to add unit tests and expand the documentation, but it's nice to see people actually want to use it.

I'm going to have a look at it this evening when I get back from work.

After a quick look at your source, it looks like you copy/pasted a typo of mine into your configuration.
Change line 10 of Gruntfile.js from:

'dist/index.html': 'app/index.tpl.hml'

to:

'dist/index.html': 'app/index.tpl.html'

@jwvdiermen

Yes, it's nice and while searching for something similar I've seen people doing complicated workarounds for something that simple. So it's a very useful task.

By the way - I think I found the issue. It's just the example config is wrong. It should provide a list of files like so:

includeSource: {
    options: {
      basePath: 'app'
    },
    targetName: {
      files: {'dist/index.html': 'app/index.tpl.html'}
    }
  }
},

(updated)

Seems to be minor nesting issue in the example. And the task name is wrong as well. Its in fact includeSource rather than include_source.

So I finally got it to work :)
Thanks!

I updated the documentation to remove the task name typo, thanks for bringing that to my attention.

I guess you have to nest the files property because it's a multi task. Here is an example I use in one of my projects:

includeSource: {
    server: {
        options: {
            basePath: '<%= env.app %>'
        },
        files: {
            '<%= env.temp %>/index.html': '<%= env.app %>/index.html',
            '<%= env.temp %>/login.html': '<%= env.app %>/login.html'
        }
    }
}

Sure no problem :)

UPDATED: But my point actually was that you should have files inside your tasks target (server in your example). So the example on the homepage won't work, because files get treated as a target/subtask like includeSource:files that has no files defined.

Hope I managed to explain that well :)

That's what I meant to, but I forgot that the example was wrong. It's updated now, thanks for explaining.