Open damoncasale opened 8 years ago
If you thing something is wrong you are very much welcome to send a PR.
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
Err, never mind, totally missed the useRelativePaths
option. Works as expected!
That's odd. useRelativePaths didn't work for me, setting it to either true or false.
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.
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.
@unsafePtr Make sure useRelativePaths
has a lowercase u
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.