Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve relative path, not only aside files #65

Open
damoncasale opened this issue Sep 6, 2016 · 8 comments
Open

Resolve relative path, not only aside files #65

damoncasale opened this issue Sep 6, 2016 · 8 comments

Comments

@damoncasale
Copy link

Templates are supposed to be declared relative to the individual folders that the template files are in, whereas this plugin expects them to be declared relative to the root module. That's wrong, and should be fixed.

And yes, UseRelativePaths is set to false and I'm still seeing that behavior. I looked at the code and there's no possible way for it to properly detect the paths of templates in subfolders, relative to their components.

In getFilePath, absPath simply cannot determine the correct relative path. file.path is always the path of app.module.ts, rather than the path of the related component.

@ludohenin
Copy link
Owner

If you thing something is wrong you are very much welcome to send a PR.

@ludohenin ludohenin changed the title As far as I'm concerned, this is implemented completely wrong. Resolve relative path, not only aside files Sep 8, 2016
@gregjacobs
Copy link
Contributor

Yes, this is definitely an issue when using relative html/css paths in components.

For instance, my component looks like this:

// app/my-component/my.component.ts
@Component( {
    selector: 'my-component',
    moduleId: __moduleName,
    templateUrl: './my.component.html',
    styleUrls: [ './my.component.css' ]
} )
export class MyComponent {}

Here, gulp-inline-ng2-template looks for ./my.component.html instead of ./app/my-component/my.component.html

@gregjacobs
Copy link
Contributor

Err, never mind, totally missed the useRelativePaths option. Works as expected!

@damoncasale
Copy link
Author

That's odd. useRelativePaths didn't work for me, setting it to either true or false.

@gforceg
Copy link

gforceg commented Oct 24, 2016

This solved the problem for me too!
It seems to me that it would be more intuitive if useRelativePaths was true by default, but now I know to set it when I use this plugin.

@unsafePtr
Copy link

How to deal with systemjs and module.id property in angular component? Setting UseRelativePaths doesn't help - base: "/appTS", target: "es5", UseRelativePaths: true,. The plugin does not look at sub-folders and try to find all templates in the base folder.

@gregjacobs
Copy link
Contributor

@unsafePtr Make sure useRelativePaths has a lowercase u

@unsafePtr
Copy link

unsafePtr commented Nov 29, 2016

@gregjacobs Thanks. It was source mistake where is written with big U. May be you can help cause it is a very big headache for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants