{"id":15410575,"url":"https://github.com/damienbod/angularwebpackvisualstudio","last_synced_at":"2025-04-04T20:11:18.599Z","repository":{"id":9135955,"uuid":"60759864","full_name":"damienbod/AngularWebpackVisualStudio","owner":"damienbod","description":"Template for ASP.NET Core, Angular with Webpack and Visual Studio","archived":false,"fork":false,"pushed_at":"2022-12-10T16:07:32.000Z","size":20253,"stargazers_count":487,"open_issues_count":21,"forks_count":126,"subscribers_count":55,"default_branch":"main","last_synced_at":"2025-03-28T19:08:05.733Z","etag":null,"topics":["angular","aot","aspnet-core","aspnetcore","hmr","lazy-loading","template","typescript","visual-studio","webpack"],"latest_commit_sha":null,"homepage":"https://damienbod.com/2016/06/12/asp-net-core-angular2-with-webpack-and-visual-studio/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damienbod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-09T08:23:52.000Z","updated_at":"2025-03-05T03:14:34.000Z","dependencies_parsed_at":"2022-09-14T02:11:45.432Z","dependency_job_id":null,"html_url":"https://github.com/damienbod/AngularWebpackVisualStudio","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2FAngularWebpackVisualStudio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2FAngularWebpackVisualStudio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2FAngularWebpackVisualStudio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2FAngularWebpackVisualStudio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damienbod","download_url":"https://codeload.github.com/damienbod/AngularWebpackVisualStudio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242678,"owners_count":20907134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","aot","aspnet-core","aspnetcore","hmr","lazy-loading","template","typescript","visual-studio","webpack"],"created_at":"2024-10-01T16:45:05.837Z","updated_at":"2025-04-04T20:11:18.577Z","avatar_url":"https://github.com/damienbod.png","language":"JavaScript","readme":"# Angular Visual Studio Webpack Starter\r\n[![Build status](https://ci.appveyor.com/api/projects/status/3x6y01a8312x6o2p?svg=true)](https://ci.appveyor.com/project/damienbod/angular2webpackvisualstudio)\r\n\r\n\u003eTemplate for [Webpack](https://webpack.js.org/concepts/), [Visual Studio](https://www.visualstudio.com/), [ASP.NET Core](https://docs.microsoft.com/en-us/dotnet/core/) and [Angular](https://angular.io/). Both the client and the server side of the application are implemented inside one ASP.NET Core project which makes it easier to deploy.\r\n\r\n![vs_webpack_angular2](https://damienbod.files.wordpress.com/2016/06/vs_webpack_angular2.png?w=600)\r\n\r\n## Features\r\n- Angular [AoT compilation](https://angular.io/guide/aot-compiler)\r\n- Angular [Lazy-loading modules with the router](https://angular.io/guide/ngmodule#lazy-loading-modules-with-the-router)\r\n- Angular [Style Guide](https://angular.io/guide/styleguide)\r\n- Webpack [Hot Module Replacement](https://webpack.js.org/guides/hot-module-replacement/)\r\n- Webpack [DevServer](https://webpack.js.org/configuration/dev-server/)\r\n- Development \u0026 Production builds\r\n- SASS, CSS\r\n- Testing client using _Jasmine_ and _Karma_\r\n- Testing server usign _xUnit_\r\n- _Yarn_ \u0026 _npm 5_\r\n\r\n## Authors\r\n\u003cimg src=\"https://avatars.githubusercontent.com/u/11268349?v=3\" width=\"70\" alt=\"Fabian Gosebrink\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/3442158?v=3\" width=\"70\" alt=\"Damien Bowden\"\u003e\u003cimg src=\"https://pbs.twimg.com/profile_images/707847627992338432/ytT_FxUY_400x400.jpg\" width=\"70\" alt=\"Roberto Simonetti\"\u003e\r\n\r\n_[Fabian Gosebrink](https://twitter.com/FabianGosebrink), [Damien Bowden](https://twitter.com/damien_bod), [Roberto Simonetti](https://twitter.com/robisim74)_\r\n\r\nBlogs:\r\n- [damienbod.com](https://damienbod.com/2016/06/12/asp-net-core-angular2-with-webpack-and-visual-studio/)\r\n- [offering.solutions](http://offering.solutions//blog/articles/2016/06/12/asp-net-core-angular-2-webpack-visual-studio/)\r\n\r\n## Table of contents\r\n* [Project structure](#1)\r\n* [Installing](#2)\r\n* [Running](#3)\r\n\t* [Commands](#3.1)\r\n\t* [Development](#3.2)\r\n\t* [Production](#3.3)\r\n* [Testing](#4)\r\n* [Dotnet Template](#5)\r\n* [Notes](#6)\r\n* [Links](#7)\r\n\r\n## \u003ca name=\"1\"\u003e\u003c/a\u003eProject structure\r\n- **src**\r\n\t- **AngularWebpackVisualStudio** _ASP.NET Core Web API project_\r\n\t\t- **.template.config** _Folder containing the template information about the dotnet new template_\r\n\t\t- **wwwroot** _Root for Angular application deployment_\r\n\t\t- **angularApp** _Angular application_\r\n\t\t\t- **main.ts** _Entry point for JiT compilation_\r\n\t\t\t- **main-aot.ts** _Entry point for AoT compilation_\r\n\t\t\t- **tests** _Client tests_\r\n\t\t- **config** _Folder for configuration files_\r\n\t\t\t- **webpack.dev.js** _webpack configuration file for development_\r\n\t\t\t- **webpack.prod.js** _webpack configuration file for production_\r\n\t\t\t- **webpack.test.js** _webpack configuration file for testing_\r\n\t\t\t- **spec.bundle.js** _Used for client testing_\r\n\t\t- **Controllers** _Folder for API controllers_\r\n\t\t- **Models** _Folder for models_\r\n\t\t- **Startup.cs** _Web API configuration_\r\n\t\t- **package.json** _Packages for Angular app_\r\n\t\t- **karma.conf.js** _Karma configuration for client testing_\r\n\t\t- **tsconfig.json** \u0026 **tsconfig-aot.json** _TypeScript \u0026 ngc compiler options_\r\n\t\t- **webpack.config.js** _Webpack configuration file for development \u0026 production of Angular app_\r\n- **tests**\r\n\t- **AngularWebpackVisualStudio_Tests** _API tests_\t\r\n\r\n## \u003ca name=\"2\"\u003e\u003c/a\u003eInstalling\r\nRequirements:\r\n- At least [.NET Core 2.0.0](https://www.microsoft.com/net/download/core)\r\n- At least _node 6.9_ and _npm 4_\r\n\r\n#### Yarn\r\nYou can use this template also with [yarn](https://yarnpkg.com/en/docs/install).\r\n\r\n#### Visual Studio\r\nThe installed _nodejs_ on your system needs to be used inside Visual Studio and not the _nodejs_ from Visual Studio. You need to set the path of your node before the VS node.\r\n\r\nIn Visual Studio: _Tools -\u003e Options -\u003e Projects and Solutions -\u003e Web Package Management -\u003e External Web Tools_\r\n\r\nMove the _$(Path)_ option above the Visual Studio one.\r\n\r\n#### NPM Task Runner\r\nThe _NPM Task Runner_ can be used to build the client application from inside Visual Studio. This task runner can be downloaded from:\r\n\r\nhttps://marketplace.visualstudio.com/items?itemName=MadsKristensen.NPMTaskRunner\r\n\r\n## \u003ca name=\"3\"\u003e\u003c/a\u003eRunning\r\nThe ASP.NET Core application contains both the server side API services and also hosts the Angular client application. The source code for the Angular application is implemented in the _angularApp_ folder. Webpack is then used to deploy the application, using the development build or a production build, which deploys the application to the wwwroot folder. This makes it easy to deploy the application using the standard tools from Visual Studio with the standard configurations.\r\n\r\n### \u003ca name=\"3.1\"\u003e\u003c/a\u003eCommands\r\nThe npm scripts are used to build, watch the client application as required. The scripts can be run from the command line or the _NPM Task Runner_.\r\n\r\nThe _watch-webpack-dev_ npm script automatically starts in Visual Studio because it has been added to the _package.json_:\r\n```\r\n\"-vs-binding\": { \"ProjectOpened\": [ \"watch-webpack-dev\" ] }\r\n```\r\n\r\nAll available commands are the following:\r\n```\r\n\"start\": \"concurrently \\\"webpack-dev-server --env=dev --open --hot --inline --port 8080\\\" \\\"dotnet run\\\" \",\r\n\"webpack-dev\": \"webpack --env=dev\",\r\n\"webpack-production\": \"webpack --env=prod\",\r\n\"build-dev\": \"npm run webpack-dev\",\r\n\"build-production\": \"npm run webpack-production\",\r\n\"watch-webpack-dev\": \"webpack --env=dev --watch --color\",\r\n\"watch-webpack-production\": \"npm run build-production --watch --color\",\r\n\"publish-for-iis\": \"npm run build-production \u0026\u0026 dotnet publish -c Release\",\r\n\"test\": \"karma start\",\r\n\"test-ci\": \"karma start --single-run --browsers ChromeHeadless\",\r\n\"lint\": \"tslint ./angularApp\"\r\n```\r\n\r\n### \u003ca name=\"3.2\"\u003e\u003c/a\u003eDevelopment\r\nFor the Angular app, we use _JiT compilation_.\r\n```\r\nnpm run build-dev\r\n```\r\n#### Watch for development\r\n```\r\nnpm run watch-webpack-dev\r\n```\r\n#### Hot Module Replacement\r\n```\r\nnpm start\r\n```\r\n\r\n### \u003ca name=\"3.3\"\u003e\u003c/a\u003eProduction\r\nFor the Angular app, we use _AoT compilation_, tree shaking \u0026 minification.\r\n```\r\nnpm run webpack-production\r\n```\r\n\r\n## \u003ca name=\"4\"\u003e\u003c/a\u003eTesting\r\nThe _xUnit_ test for ASP.NET Core API is in _tests/AngularWebpackVisualStudio_Tests_ folder:\r\n```\r\ndotnet test\r\n```\r\nor from Visual Studio: _Test -\u003e Run -\u003e All Tests_\r\n\r\nSee this link for more details on _xUnit_ testing in ASP.NET Core: https://docs.microsoft.com/it-it/dotnet/articles/core/testing/unit-testing-with-dotnet-test\r\n\r\nThe Angular test is in _angularApp/tests_ folder. It uses _Karma_ test runner and _Jasmine_ test framework:\r\n```\r\nnpm test\r\n```\r\n\r\nruns the tests and watches for development. If you want to run the tests with a headless browser only one single time just type\r\n```\r\nnpm run test-ci\r\n```\r\n\r\nSee this link for more details on Angular testing: https://angular.io/guide/testing\r\n\r\n## \u003ca name=\"5\"\u003e\u003c/a\u003eDotnet Template\r\nTo install a template for this package we prepared a `template.json` to do that.\r\n\r\nJust run `dotnet new --install \u003cPATH\u003e` where \u003cPATH\u003e is the path to the folder where the `.template.config` folder lives.\r\n\r\nAfter that you should see the template when running `dotnet new` on commandline\r\n\r\n![dotnetnew](.github/dotnet-new.jpg \"dotnetnew\")\r\n\r\nNow you can use the temaplte with `dotnet new angularwebapi`\r\n\r\n\r\n## \u003ca name=\"6\"\u003e\u003c/a\u003eNotes\r\nThe Webpack configuration could also build all of the scss and css files to a separate _app.css_ or _app.\"hash\".css_ which could be loaded as a single file in the distribution. Some of the vendor js and css could also be loaded directly in the html header using the _index.html_ file and not included in the Webpack build.\r\n\r\n## \u003ca name=\"7\"\u003e\u003c/a\u003eLinks\r\n- [Lazy Loading](https://github.com/damienbod/Angular2WebpackVisualStudio/tree/master/docs/LAZY_LOADING.md)\r\n- [Hot Module Replacement](https://github.com/damienbod/Angular2WebpackVisualStudio/tree/master/docs/HMR.md)\r\n\r\n- [Building production ready Angular apps with Visual Studio and ASP.NET Core](https://damienbod.com/2017/01/01/building-production-ready-angular-apps-with-visual-studio-and-asp-net-core/)\r\n\r\n## License\r\nMIT\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamienbod%2Fangularwebpackvisualstudio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamienbod%2Fangularwebpackvisualstudio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamienbod%2Fangularwebpackvisualstudio/lists"}