generator-mvc6-angular
Yeoman generator
Sorry everyone who has downloaded this recently, I was just testing publishing it to npm (my first npm release), so there are some issues!
Getting Started
Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.
npm install -g yo
To install generator-mvc6-angular from npm, run:
npm install -g generator-mvc6-angular
Initiate the generator:
yo mvc6-angular
Finally, follow the instructions on the generator. It will prompt you for the name of the app.
Usage
Note: You need to have Visual Studio 2013 or 2015 installed.
- To build, you run, you must go to the Task Runner Explorer, and run the
build
task. This will build the angular front-end into the wwwroot
folder.
- Then press the start button
Creating the client
As you know, the client is made with Angular, and its all in the Client
folder. index.js
is the main file which declares your app's namespace, and the rest of the Angular app is inside the App
folder.
Inside the App
folder, you get the Components
folder, which stores the components of the app, and the rest of the different pages. You are provided with a default Main
folder, which is the main page you see when you start the app.
By default, the generator uses superior ui.router
, to add more routes, edit the index.js
file. I will add options for future releases though.
Directory structure
Here is the directory structure for the Client
folder:
├── Client
│ ├── App - All of our app specific components go in here
| | ├── Components - Our reusable components, non-specific to to our app
│ | ├── Main - Specific app component
│ | └ index.js - The main angular js file which declares angular dependancies and routes.
│ ├── Assets - Custom assets: fonts, images, etc…
│ └── index.html - App entry point
│
Building the client
As mentioned above, for your changes to show on the browser, you must build the client using Grunt by using the Task Runner Explorer
. The build script contains uglifying, concating and js and sass files.
If you are fancy, you can set up automatic building upon Starting the app by adding a binding
:
Back-end
We recommend you to make a RESTful service to communicate with the Angular Client to a nice and clean separation of concern:
- To do so, right click a folder, and select `Add > New Item:
- Select
Web API Controller Class
to generate a RESTful API template.
Features
Bootstrap
Angular
Grunt - ASP.NET MVC6 has the Task Runner Explorer which has built in Grunt support!
Bower, NPM and NuGet - ASP.NET MVC6 has built in support for these three repositories! To install new dependencies, right click > restore
Getting To Know Yeoman
Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.
If you'd like to get to know Yeoman better and meet some of his friends, Grunt and Bower, check out the complete Getting Started Guide.
License
(The MIT License)
Copyright (c) Dolan Miu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.