Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 28f46b1

Browse files
Splaktarjelbourn
authored andcommitted
refactor: styles refactoring. disable commonChunk (#653)
- pull palette and theme definitions into _app-theme.scss - rename main.scss to styles.scss to align with CLI - changes reduce production app size by 9 KB
1 parent b90b671 commit 28f46b1

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

angular.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
],
4141
"styles": [
4242
{
43-
"input": "src/main.scss"
43+
"input": "src/styles.scss"
4444
},
4545
{
4646
"input": "src/highlightjs/material-light.scss"
@@ -76,6 +76,7 @@
7676
"maximumWarning": "6kb"
7777
}
7878
],
79+
"commonChunk": false,
7980
"optimization": true,
8081
"outputHashing": "all",
8182
"sourceMap": false,
@@ -121,7 +122,7 @@
121122
"scripts": [],
122123
"styles": [
123124
{
124-
"input": "src/main.scss"
125+
"input": "src/styles.scss"
125126
},
126127
{
127128
"input": "src/highlightjs/material-light.scss"
@@ -192,4 +193,4 @@
192193
"cli": {
193194
"analytics": "cf155f04-1636-4df9-9ce2-870ba25ad38d"
194195
}
195-
}
196+
}

src/_app-theme.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
@import './styles/svg-theme';
1616
@import './styles/tables-theme';
1717

18-
1918
// Styles for the docs app that are based on the current theme.
2019
@mixin material-docs-app-theme($theme) {
2120
$primary: map-get($theme, primary);
@@ -61,3 +60,9 @@
6160
@include nav-bar-theme($theme);
6261
@include table-of-contents-theme($theme);
6362
}
63+
64+
// Define the light theme.
65+
$primary: mat-palette($mat-indigo);
66+
$accent: mat-palette($mat-pink, A200, A100, A400);
67+
68+
$theme: mat-light-theme($primary, $accent);
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
@import '~@angular/material/theming';
21
@import './app-theme';
32
@import './styles/api';
43
@import './styles/markdown';
54
@import './styles/tables';
65
@import './styles/general';
76

8-
97
// Include material core styles.
108
@include mat-core();
119

12-
13-
// Define the light theme.
14-
$primary: mat-palette($mat-indigo);
15-
$accent: mat-palette($mat-pink, A200, A100, A400);
16-
17-
$theme: mat-light-theme($primary, $accent);
1810
@include angular-material-theme($theme);
1911
@include material-docs-app-theme($theme);

0 commit comments

Comments
 (0)