-
Notifications
You must be signed in to change notification settings - Fork 29
Description
I generally like this mechanism, nice work.
It's a bit different from my own approach but I like your solution because it solves the issue of not having to worry about copying content to the applications output Directory on build. This means you get nice in-place editing of files too because you can use PhsyicalFileProviders over the static content directly in the projects wwwroot folder on disk.
The only weakness is that it requires you to structure your source code in a certain way, i.e all Modules in a Modules folder. This also means when deploying your application, you have to remember to publish that folder too - which will contain source code - necessitating in the use of the "exclude" attribute.
I am far down the path of a slightly different approach at the moment, where the application uses DependencyContext to find referenced Modules, and then wires up EmbeddedFileProvider's for static content, and razor files etc. This means you can structure the solution however you like, don't need to worry about "exclude" attributes in project.json, but have to use "embed" attributes in project.json instead, to embed static content / Views folder in your assemblies. The downfall of my approach is that this works great for a published application, but during development time, as static files are embedded, you lose the ability to edit them on the fly, you have to edit them and re-build to produce the newer assembly containing the modified content. This would be a massive pain when editing .js / html files for example, so I am now working on a workaround to that problem perhaps so that EmbeddedFileProvider are only used for a published / released app, and PhsyicalFileProviders are used at development time, pointing at the project's folders similar to this solution.
Anyway, thanks for this example, was a very simple way of achieving a modular result!