generator-ko
generator-ko copied to clipboard
Components in ASP.NET 5 Projects
Hello,
I was wondering how you would recommend structuring the components folder in an ASP.NET 5 project when using TypeScript (or ES6 with Babel). The default ASP.NET 5 template places static files (the HTML files) into the wwwroot folder, and files that need to be compiled (ES6 JS files with Babel or TS files) into the src folder. Using their template, would you separate the static files from the compiled files or would you put them together and use a gulp task to copy the html files to the wwwroot folder?
Keeps the ViewModel and Template files together in one folder, but I will need to use gulp to copy the html files without modifying them at all
- wwwroot
- components
- test-component
- test-component.ts
- test-component.html
- test-component
- components
vs
Keeps the logical separation of static and compiled files, but adds complexity to the project structure since component ViewModels and Templates would be located in different folders
- wwwroot
- components
- test-component
- test-component.html
- test-component
- components
- components
- test-component
- test-component.ts
- test-component
Thanks,
Chris
@ChristopherHaws,
Here's my two cents on that, FWIW. First off, I think this is dependent on your build set up. We typically use webpack in our web projects. As such, my preference is to keep the source JS out of the wwwroot
directory since that appears to be intended for deployment artifacts belong. Instead, I keep my components and other source in an App
directory under the project root and I direct webpack to export it's build files to wwwroot\js
. Since you're using babel, your source code is also source and should be excluded from deployment, in my opinion.
Perhaps you've already arrived at this conclusion, or possibly another which you are even more satisfied with. Hopefully that was somewhat insightful or at least reassuring!