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

Unable to use Components' templateUrl property #23

Open
indrimuska opened this issue Feb 18, 2017 · 5 comments
Open

Unable to use Components' templateUrl property #23

indrimuska opened this issue Feb 18, 2017 · 5 comments

Comments

@indrimuska
Copy link

indrimuska commented Feb 18, 2017

Hi Guys,

I've just tried fuse-box and it's just unbelievably fast! Nothing compared with the tons configuration I've write to run webpack or systemjs in a simple "hello world" project. And this project also helped me a lot to start working with fuse-box.

I was wondering if there's a way (or a plugin) to use Angular2 Components' templateUrl property instead of just requiring the template and push it in the code. Basically I would like to avoid calling the require function and just write the url of my template. This is more annoying when you have an array of css to include (using RawPlugin for css files).

Current usage Preferred usage
@Component({
  selector: 'app',
  template: require('./app.component.html')
  styles: [ require('./app.component.css') ]
}
@Component({
  selector: 'app',
  templateUrl: './app.component.html'
  styleUrls: [ './app.component.css' ]
}

Anyway, the result should be the same for both usage, so the template content will be pushed in the bundle itself. But, since this feature is already available in webpack/systemjs, do you mind it will be also for fuse-box? Maybe "overriding" (decorating), if possibile, the decorator implementation?

Thank you :)

@devmondo
Copy link
Member

@indrimuska thanks a lot for te awesome words :) yea Fuse is aiming to make your life drastically better!
we have great Decorator and metadata support.

if you check this article https://medium.com/fusebox/webpack-is-not-the-only-way-6ddb67e99be9#.1bmgfywgq, especially the Extended metadata properties part, you would see how we can achieve some magic that may solve your issue or inspire you to create better solution

@indrimuska
Copy link
Author

Thank you @devmondo.
What are your thought about this feature? Do you think such solution could be feasible?

@nchanged
Copy link
Contributor

@indrimuska yes it's feasible. However, it requires a custom plugin that would regenerate the code

@alex-klock
Copy link

I just published a fuse-box plugin that will handle this scenario if you are interested... https://github.com/alex-klock/ng2-fused

@indrimuska
Copy link
Author

Good @alex-klock, it looks very promising! I'll take a look at that! 👍

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

4 participants