ludohenin / gulp-inline-ng2-template

Gulp plugin to inline HTML and CSS into Angular 2 component decorators
MIT License
126 stars 26 forks source link

Pass absolute path as parameter in `templateProcessor` #49

Closed bekos closed 8 years ago

bekos commented 8 years ago

When using relative paths it's difficult to get the absolute path of the rendered file. This is needed when for example we want to set the filename into the jade compiler.

ludohenin commented 8 years ago

Not sure to fully understand. Where exactly do you need the full path? There's an example of jade compilation here https://github.com/ludohenin/gulp-inline-ng2-template/blob/master/test/test.js#L70-L72

bekos commented 8 years ago

In order to be able to use extends or include into a jade file, you have to also specify the filename on the render function. That;s when the absolute file path is required, and not just the contents.

Check this PR on how I plan to do it now. https://github.com/ng-lightning/ng-lightning/pull/125

I hope it's clear now :-) Great project btw 👍

ludohenin commented 8 years ago

yes it's clear now :-) The thing is that I have to make a breaking change to support this and I'm not sure I want to that. If you have an idea, feel free to sent a PR

bekos commented 8 years ago

It does not have to be a breaking change. It can be an extra 4th parameter or another property of the 1st argument (ext in the examples).

ludohenin commented 8 years ago

A 4th parameter doesn't look that pretty and the first 2 are strings so if I change them it'll break things. I think I'll break it and make only 2 args:

  1. an object with ext, rel_path, abs_path, content (whatever will need later)
  2. the callback
bekos commented 8 years ago

I think 1st argument is an object but I will check again. Thanks for your response.

bekos commented 8 years ago

For var ext on https://github.com/ludohenin/gulp-inline-ng2-template/blob/master/parser.js#L224 I believe you can do ext.absPath = absolute_path; if you don't want to introduce a breaking change.

ludohenin commented 8 years ago

This is there, v3.0.0

bekos commented 8 years ago

@ludohenin Cool. Thx 👍