We all are familiar with SPA or Single Page Applications like Angular 2 in development. Aurelia is another famous Single Page Application development technique in the market similar to Angular 2 but syntactically different. Now, we are going to configure Aurelia Single Page Applications in ASP.NET Core 1.0.
Before reading this article, you must read the articles given below for ASP.NET Core knowledge.
The following steps need to be followed to configure Aurelia Single Page Applications in ASP.NET Core 1.0.
Node.js is very powerful JavaScript-based framework built on Chrome's V8 JavaScript Engine. Node.js' package ecosystem and npm are the largest ecosystems of open source libraries in the world.
Download and install Node.js on your machine: Node.js
After completing the installation, we can check the currently running version of Node.js in our machine through command prompt:
Command for Version Checking - "node -v"
Download and install appropriate Git on your machine from Git - Downloads
jspm or JavaScript Package Manager is a package manager for the SystemJS universal module loader and it is built on top of the dynamic ES6 module loader.
jspm installation command - "npm install -g jspm"
After installing, we can check the currently running version of jspm on our machine through command prompt, using the following command:
"jspm -v"
The following command will help to change our current "C Drive" to "F Drive" because currently our Aurelia project is saved to "F Drive".
Now, we are going to install jspm in our ASP.NET Core 1.0 application.
"jspm init"
During the jspm initialization, it will ask a few questions. We have to enter three values in the following questions.
1. Enter server baseURL (public folder path) [./]
wwwroot (saved all jspm references into Webroot or wwwroot but you can choose any folder).
2. Do you wish to use a transpiler?[yes]:
yes (Transpiler is similar to Compiler. It converts ES2015 to ES5).
3. Which ES6 transpiler would you like to use, Babel, TypeScript or Traceur? [traceur] :
Babel (You can choose either Babel or TypeScript).
The following command will help to install Aurelia framework in ASP.NET Core 1.0:
"jspm install aurelia-framework"
The following command will help to install Aurelia bootstrapper in ASP.NET Core 1.0:
"jspm install aurelia-bootstrapper"
Click "show all files icon" in Solution Explorer. Then, you can see the jspm_packages reference and config.js inside the wwwroot.
The following JSON file contains all the details about Aurelia configuration:
System.config({
baseURL:
"/"
,
defaultJSExtensions:
true
transpiler:
"babel"
babelOptions: {
"optional"
: [
"runtime"
"optimisation.modules.system"
]
},
paths: {
"github:*"
:
"jspm_packages/github/*"
"npm:*"
"jspm_packages/npm/*"
map: {
"aurelia-bootstrapper"
"npm:aurelia-bootstrapper@2.0.1"
"aurelia-framework"
"npm:aurelia-framework@1.0.8"
"aurelia-pal-browser"
"npm:aurelia-pal-browser@1.1.0"
"npm:babel-core@5.8.38"
"babel-runtime"
"npm:babel-runtime@5.8.38"
"core-js"
"npm:core-js@1.2.7"
"github:jspm/nodelibs-assert@0.1.0"
: {
"assert"
"npm:assert@1.4.1"
"github:jspm/nodelibs-buffer@0.1.0"
"buffer"
"npm:buffer@3.6.0"
"github:jspm/nodelibs-path@0.1.0"
"path-browserify"
"npm:path-browserify@0.0.0"
"github:jspm/nodelibs-process@0.1.2"
"process"
"npm:process@0.11.9"
"github:jspm/nodelibs-util@0.1.0"
"util"
"npm:util@0.10.3"
"github:jspm/nodelibs-vm@0.1.0"
"vm-browserify"
"npm:vm-browserify@0.0.4"
"npm:aurelia-binding@1.1.1"
"aurelia-logging"
"npm:aurelia-logging@1.2.0"
"aurelia-metadata"
"npm:aurelia-metadata@1.0.3"
"aurelia-pal"
"npm:aurelia-pal@1.2.0"
"aurelia-task-queue"
"npm:aurelia-task-queue@1.1.0"
"aurelia-event-aggregator"
"npm:aurelia-event-aggregator@1.0.1"
"aurelia-history"
"npm:aurelia-history@1.0.0"
"aurelia-history-browser"
"npm:aurelia-history-browser@1.0.0"
"aurelia-loader-default"
"npm:aurelia-loader-default@1.0.0"
"aurelia-logging-console"
"npm:aurelia-logging-console@1.0.0"
"aurelia-polyfills"
"npm:aurelia-polyfills@1.1.1"
"aurelia-router"
"npm:aurelia-router@1.1.1"
"aurelia-templating"
"npm:aurelia-templating@1.2.0"
"aurelia-templating-binding"
"npm:aurelia-templating-binding@1.2.0"
"aurelia-templating-resources"
"npm:aurelia-templating-resources@1.2.0"
"aurelia-templating-router"
"npm:aurelia-templating-router@1.0.1"
"npm:aurelia-dependency-injection@1.3.0"
"aurelia-binding"
"aurelia-dependency-injection"
"aurelia-loader"
"npm:aurelia-loader@1.0.0"
"aurelia-path"
"npm:aurelia-path@1.1.1"
"npm:aurelia-route-recognizer@1.1.0"
"aurelia-route-recognizer"
"base64-js"
"npm:base64-js@0.0.8"
"child_process"
"github:jspm/nodelibs-child_process@0.1.0"
"fs"
"github:jspm/nodelibs-fs@0.1.2"
"ieee754"
"npm:ieee754@1.1.8"
"isarray"
"npm:isarray@1.0.0"
"path"
"systemjs-json"
"github:systemjs/plugin-json@0.1.2"
"npm:inherits@2.0.1"
"vm"
"inherits"
"indexof"
"npm:indexof@0.0.1"
}
});
The following JSON file contains all the dependencies of Aurelia:
{
"jspm"
"directories"
"baseURL"
"wwwroot"
"dependencies"
"npm:aurelia-bootstrapper@^2.0.1"
"npm:aurelia-framework@^1.0.8"
"npm:aurelia-pal-browser@^1.1.0"
"devDependencies"
"npm:babel-core@^5.8.24"
"npm:babel-runtime@^5.8.24"
"npm:core-js@^1.1.4"
We learned how to configure Aurelia Single Page Applications in ASP.NET Core 1.0. Hope you liked this article. Please share your valuable suggestions and feedback.