# MVC core webpack template

**URL:** <https://discourse.aurelia.io/t/mvc-core-webpack-template/1095>\
**Category:** Best Practices\
**Created:** [April 18, 2018, 3:51pm UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095 "2018-04-18T15:51:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![constructor](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/constructor/32/710_2.png) [@constructor](https://discourse.aurelia.io/u/constructor)\
**Post date:** [April 18, 2018, 3:51pm UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/1 "2018-04-18T15:51:19Z")

</div>

Here is an Aurelia CLI, .net core 2.0 MVC, webpack template.  
`dotnet new -i Designs.Digital.Aurelia.Templates.MVC`

This will install the ‘dotnet new’ template. After installation it can be used as follows:

`dotnet new au-net -n Site -ow "Bob" -t "Test Site"`

`au-net` is the name of the template `-n Site` an arbitrary name for the project, `-ow "Bob"` and `-t "Test Site"` are just test values that are replaced in the ‘Loading…’ string.  
For more information: `dotnet new au-net --help`

Since I am using Windows 10 the following is an example for that platform. The equivalent for other platforms should work. To get an Aurelia CLI, MVC core, webpack site running in one go:

1. Create an empty directory to place your project.
2. Open a shell to that directory.
3. Run or paste the following:  
`dotnet new -i Designs.Digital.Aurelia.Templates.MVC`  
`dotnet new au-net -n Site -ow "Bob" -t "Test Site"`  
`cd site`  
`yarn install`  
`au run`

The template will be installed, site generated, build and run. Simply open a browser at `http://localhost:8080` to view (or check console output for url).

So, why?

I was looking at the Aurelia CLI and how it generated sites from the user input. I was thinking about the possibility of having templates accessable via the CLI but external to it. This may allow easier maintenance and creation of more templates?

---

<div class="post-metadata">

**Author:** ![MaximBalaganskiy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/maximbalaganskiy/32/831_2.png) [@MaximBalaganskiy](https://discourse.aurelia.io/u/MaximBalaganskiy)\
**Post date:** [April 19, 2018, 12:48am UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/2 "2018-04-19T00:48:41Z")

</div>

I couldn’t find a repo for the template… Would you accept a PR?

---

<div class="post-metadata">

**Author:** ![constructor](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/constructor/32/710_2.png) [@constructor](https://discourse.aurelia.io/u/constructor)\
**Post date:** [April 19, 2018, 8:41am UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/3 "2018-04-19T08:41:06Z")

</div>

I did not upload a repo for the template as it was only intended as a conversation starter. I could do this though. I think having a series of CLI compatible templates external to the CLI itself makes sense from a maintenance perspective? Did you find a specific issue?  
Getting people from zero to up and running quickly, understandably and without issue is vital initial positive experience and to adoption. My own initial CLI experience forced me to apply fixes to get up and running. Regardless of the reasons this should not be the case.

---

<div class="post-metadata">

**Author:** ![MaximBalaganskiy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/maximbalaganskiy/32/831_2.png) [@MaximBalaganskiy](https://discourse.aurelia.io/u/MaximBalaganskiy)\
**Post date:** [April 19, 2018, 9:22am UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/4 "2018-04-19T09:22:06Z")

</div>

Funny enough, a couple of days ago I posted a link to another dotnet+webpack skeleton.

The issue I’ve found is bloated app bundle. In my opinion, it’s better to split based on a module path, not manually. Have a look at the config in this [https://github.com/MaximBalaganskiy/AureliaDotnetTemplate](https://github.com/MaximBalaganskiy/AureliaDotnetTemplate)

---

<div class="post-metadata">

**Author:** ![constructor](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/constructor/32/710_2.png) [@constructor](https://discourse.aurelia.io/u/constructor)\
**Post date:** [April 19, 2018, 10:53am UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/5 "2018-04-19T10:53:58Z")

</div>

The template itself is Aurelia CLI generated with [one or two fixes related to this](https://discourse.aurelia.io/t/fixes-to-aurelia-cli-and-test-a-project/1055).  
When I revisited Aurelia CLI a few weeks ago I found multiple issues preventing me from just getting up and running. To be fair most of these seem to be dependency related, though, it is the responsibility of the project to manage what is referenced and how in my opinion. When I took a look at the CLI source I saw how the templates were generated and thought maybe it would be better to have template source external to the CLI. The CLI could use these as opposed to generating templates internally using conditionals.  
I believe [the template you provided](https://github.com/MaximBalaganskiy/AureliaDotnetTemplate) is more of a minimal starting point rather than a CLI template?

---

<div class="post-metadata">

**Author:** ![Alexander-Taran](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/alexander-taran/32/2308_2.png) [@Alexander-Taran](https://discourse.aurelia.io/u/Alexander-Taran)\
**Post date:** [April 19, 2018, 11:07am UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/6 "2018-04-19T11:07:46Z")

</div>

@MaximBalaganskiy & @constructor  
would you guys be able to work on this in aurelia-contrib?

---

<div class="post-metadata">

**Author:** ![MaximBalaganskiy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/maximbalaganskiy/32/831_2.png) [@MaximBalaganskiy](https://discourse.aurelia.io/u/MaximBalaganskiy)\
**Post date:** [April 19, 2018, 11:13am UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/7 "2018-04-19T11:13:22Z")

</div>

@Alexander-Taran You know my predisposition towards CLI 🙂 I would be happy to change ownership of the template

---

<div class="post-metadata">

**Author:** ![constructor](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/constructor/32/710_2.png) [@constructor](https://discourse.aurelia.io/u/constructor)\
**Post date:** [April 19, 2018, 11:27am UTC](https://discourse.aurelia.io/t/mvc-core-webpack-template/1095/8 "2018-04-19T11:27:31Z")

</div>

I would be willing to contribute, but I do not know how useful the contributions would be without further understanding the nature of the CLI and how others use it. Most of the changes here are from my perspective only, along with some ideas based on personal experience.
