From 809781f5b1d464f1cac33483d574bf3c42c9fc5d Mon Sep 17 00:00:00 2001 From: Mathieu Sanchez Date: Thu, 6 Jun 2019 16:01:35 +0900 Subject: [PATCH] Change to LESS and Ivy --- angular.json | 29 +++++++++++++++-- src/app/app-routing.module.ts | 10 ++++++ src/app/app.component.html | 1 + .../{app.component.css => app.component.less} | 0 src/app/app.component.spec.ts | 31 ------------------- src/app/app.component.ts | 2 +- src/app/app.module.ts | 4 ++- src/{styles.css => styles.less} | 0 tsconfig.app.json | 5 ++- 9 files changed, 45 insertions(+), 37 deletions(-) create mode 100644 src/app/app-routing.module.ts rename src/app/{app.component.css => app.component.less} (100%) delete mode 100644 src/app/app.component.spec.ts rename src/{styles.css => styles.less} (100%) diff --git a/angular.json b/angular.json index a6f48a6..5e6d87f 100644 --- a/angular.json +++ b/angular.json @@ -5,7 +5,30 @@ "projects": { "PQ-Man": { "projectType": "application", - "schematics": {}, + "schematics": { + "@schematics/angular:component": { + "style": "less", + "skipTests": true + }, + "@schematics/angular:class": { + "skipTests": true + }, + "@schematics/angular:directive": { + "skipTests": true + }, + "@schematics/angular:guard": { + "skipTests": true + }, + "@schematics/angular:module": { + "skipTests": true + }, + "@schematics/angular:pipe": { + "skipTests": true + }, + "@schematics/angular:service": { + "skipTests": true + } + }, "root": "", "sourceRoot": "src", "prefix": "app", @@ -23,7 +46,7 @@ "src/assets" ], "styles": [ - "src/styles.css" + "src/styles.less" ], "scripts": [] }, @@ -83,7 +106,7 @@ "src/assets" ], "styles": [ - "src/styles.css" + "src/styles.less" ], "scripts": [] } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts new file mode 100644 index 0000000..d425c6f --- /dev/null +++ b/src/app/app-routing.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +const routes: Routes = []; + +@NgModule({ + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule] +}) +export class AppRoutingModule { } diff --git a/src/app/app.component.html b/src/app/app.component.html index 5226d57..0f3d9d8 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -18,3 +18,4 @@ + diff --git a/src/app/app.component.css b/src/app/app.component.less similarity index 100% rename from src/app/app.component.css rename to src/app/app.component.less diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts deleted file mode 100644 index 544065a..0000000 --- a/src/app/app.component.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { TestBed, async } from '@angular/core/testing'; -import { AppComponent } from './app.component'; - -describe('AppComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ - AppComponent - ], - }).compileComponents(); - })); - - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - }); - - it(`should have as title 'PQ-Man'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('PQ-Man'); - }); - - it('should render title in a h1 tag', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('Welcome to PQ-Man!'); - }); -}); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 10fd15d..aa323cf 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,7 +3,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] + styleUrls: ['./app.component.less'] }) export class AppComponent { title = 'PQ-Man'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index f657163..2c3ba29 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; +import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @NgModule({ @@ -8,7 +9,8 @@ import { AppComponent } from './app.component'; AppComponent ], imports: [ - BrowserModule + BrowserModule, + AppRoutingModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/styles.css b/src/styles.less similarity index 100% rename from src/styles.css rename to src/styles.less diff --git a/tsconfig.app.json b/tsconfig.app.json index 31f8397..c70de17 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -10,5 +10,8 @@ "exclude": [ "src/test.ts", "src/**/*.spec.ts" - ] + ], + "angularCompilerOptions": { + "enableIvy": true + } }