alanshaw / grunt-include-replace

Grunt task to include files and replace variables. Allows for parameterised includes.
MIT License
200 stars 45 forks source link

File path #56

Closed mledwards closed 9 years ago

mledwards commented 9 years ago

Hi there,

Is it possible to get the file path in the processIncludeContents function for manipulation?

I'm trying to get the dynamic URL in static HTML pages.

Thanks!

alanshaw commented 9 years ago

Absolutely! Should be pretty easy to pass the file path as the third parameter: https://github.com/alanshaw/grunt-include-replace/blob/master/tasks/includereplace.js#L115

PR would be gratefully accepted!

alanshaw commented 9 years ago

Hey @mledwards I had a spare 5 minutes so I added this for you - released as version 3.2.0

mledwards commented 9 years ago

Thanks for the prompt response @alanshaw!

Could it reference the generated file instead of the include? I think there's more value to the generated file as you then have access to construct a URL to the page.

I'd also suggest the path is relative to the grunt file, as it's unlikely you'll need to go further back than that for web purposes?

mledwards commented 9 years ago

Scrap that, I think my requirement is a little niche so I built a small plugin for it: https://github.com/mledwards/grunt-filepath

Thanks!