Skip to content

Commit ec3bb7e

Browse files
committed
Configure Angular Material #16
1 parent 55fc1e4 commit ec3bb7e

File tree

10 files changed

+97
-10
lines changed

10 files changed

+97
-10
lines changed

project/application/angular.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@
2323
"polyfills": "src/polyfills.ts",
2424
"tsConfig": "src/tsconfig.app.json",
2525
"assets": ["src/favicon.ico", "src/assets"],
26-
"styles": ["src/styles.scss"],
27-
"scripts": []
26+
"styles": [
27+
"node_modules/material-design-icons/iconfont/material-icons.css",
28+
"src/styles.scss"
29+
],
30+
"scripts": [
31+
"node_modules/hammerjs/hammer.min.js"
32+
]
2833
},
2934
"configurations": {
3035
"production": {
@@ -70,8 +75,13 @@
7075
"polyfills": "src/polyfills.ts",
7176
"tsConfig": "src/tsconfig.spec.json",
7277
"karmaConfig": "src/karma.conf.js",
73-
"styles": ["src/styles.scss"],
74-
"scripts": [],
78+
"styles": [
79+
"node_modules/material-design-icons/iconfont/material-icons.css",
80+
"src/styles.scss"
81+
],
82+
"scripts": [
83+
"node_modules/hammerjs/hammer.min.js"
84+
],
7585
"assets": ["src/favicon.ico", "src/assets"]
7686
}
7787
},

project/application/package-lock.json

Lines changed: 43 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

project/application/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
},
1717
"private": true,
1818
"dependencies": {
19-
"@angular/animations": "^6.1.0",
19+
"@angular/animations": "^6.1.3",
20+
"@angular/cdk": "^6.4.6",
2021
"@angular/common": "^6.1.0",
2122
"@angular/compiler": "^6.1.0",
2223
"@angular/core": "^6.1.0",
2324
"@angular/forms": "^6.1.0",
2425
"@angular/http": "^6.1.0",
26+
"@angular/material": "^6.4.6",
2527
"@angular/platform-browser": "^6.1.0",
2628
"@angular/platform-browser-dynamic": "^6.1.0",
2729
"@angular/platform-server": "^6.1.0",
@@ -33,8 +35,11 @@
3335
"domino": "^2.1.0",
3436
"es5-shim": "^4.5.10",
3537
"es6-shim": "^0.35.3",
38+
"hammerjs": "^2.0.8",
39+
"material-design-icons": "^3.0.1",
3640
"rxjs": "^6.0.0",
3741
"ts-loader": "^4.4.2",
42+
"webpack-node-externals": "^1.7.2",
3843
"zone.js": "~0.8.26"
3944
},
4045
"devDependencies": {

project/application/src/app/modules/core/core.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { NgModule } from '@angular/core';
22
import { BrowserModule, BrowserTransferStateModule } from '@angular/platform-browser';
3+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
34

45
import { RoutingModule } from '../routing/routing.module';
56

67
@NgModule({
78
imports: [
89
BrowserModule.withServerTransition({ appId: 'angular-universal' }),
910
BrowserTransferStateModule,
11+
BrowserAnimationsModule,
1012
RoutingModule,
1113
],
1214
})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { NgModule } from '@angular/core';
2+
import { MatButtonModule } from '@angular/material';
3+
4+
@NgModule({
5+
imports: [MatButtonModule],
6+
exports: [MatButtonModule],
7+
})
8+
export class CustomMaterialModule {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
<h1>{{ title }}</h1>
2+
3+
<div class="button-row">
4+
<button mat-raised-button>Basic</button>
5+
<button mat-raised-button color="primary">Primary</button>
6+
<button mat-raised-button color="accent">Accent</button>
7+
<button mat-raised-button color="warn">Warn</button>
8+
<button mat-raised-button disabled>Disabled</button>
9+
<a mat-raised-button routerLink=".">Link</a>
10+
</div>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.button-row {
2+
button, a {
3+
margin-right: 8px;
4+
}
5+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { NgModule } from '@angular/core';
22

33
import { HomeRoutingModule } from './home-routing.module';
4+
import { CustomMaterialModule } from '../custom-material/custom-material.module';
45
import { HomeComponent } from './home.component';
56

67
@NgModule({
7-
imports: [HomeRoutingModule],
8+
imports: [HomeRoutingModule, CustomMaterialModule],
89
declarations: [HomeComponent],
910
})
1011
export class HomeModule {}

project/application/src/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "~@angular/material/prebuilt-themes/indigo-pink.css";

project/application/webpack.server.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
const path = require('path');
22
const webpack = require('webpack');
3+
const nodeExternals = require('webpack-node-externals');
34

45
module.exports = {
56
entry: { server: './server.ts' },
67
resolve: { extensions: ['.js', '.ts'] },
78
target: 'node',
89
mode: 'none',
910
// this makes sure we include node_modules and other 3rd party libraries
10-
externals: [/node_modules/],
11+
externals: [
12+
/node_modules/,
13+
nodeExternals({
14+
whitelist: [/^hammerjs/],
15+
}),
16+
],
1117
output: {
1218
path: path.join(__dirname, 'tmp'),
1319
filename: '[name].js',

0 commit comments

Comments
 (0)