Skip to content

Commit

Permalink
fix(theme): replicate the same folder structure for local / prod (#1532)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre-Étienne Lord <[email protected]>
  • Loading branch information
alecarn and pelord authored Dec 12, 2023
1 parent 499a8a0 commit dd74269
Show file tree
Hide file tree
Showing 38 changed files with 267 additions and 49 deletions.
5 changes: 5 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"input": "./dist/core/locale/",
"output": "./locale/libs_locale",
"ignore": ["**/*.core.json"]
},
{
"glob": "**/*",
"input": "./dist/core/theming/prebuilt-themes",
"output": "./assets/igo2/core/theming/prebuilt-themes"
}
],
"styles": ["projects/demo/src/styles.scss"],
Expand Down
47 changes: 43 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/common/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"allowedNonPeerDependencies": ["ts-cacheable"],
"assets": [
{ "input": "src", "glob": "*.scss", "output": "src" },
{ "input": "src", "glob": "**/*.them*.scss", "output": "src" },
{ "input": "src/style", "glob": "**/*.scss", "output": "src/style" },
{ "input": "src/assets", "glob": "**/*", "output": "assets" },
Expand Down
1 change: 1 addition & 0 deletions packages/common/ng-package.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"allowedNonPeerDependencies": ["ts-cacheable"],
"assets": [
{ "input": "src", "glob": "*.scss", "output": "src" },
{ "input": "src", "glob": "**/*.them*.scss", "output": "src" },
{ "input": "src/style", "glob": "**/*.scss", "output": "src/style" },
{ "input": "src/assets", "glob": "**/*", "output": "assets" },
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"style": "./style/style.css"
},
"./theming": {
"sass": "./common-theme.scss"
"sass": "./src/common-theme.scss"
},
"./partial/*": {
"sass": "./src/style/partial/*.scss"
Expand Down
1 change: 1 addition & 0 deletions packages/context/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"allowedNonPeerDependencies": ["ts-md5"],
"assets": [
{ "input": "src", "glob": "*.scss", "output": "src" },
{ "input": "src", "glob": "**/*.them*.scss", "output": "src" },
{ "input": "src/style", "glob": "**/*.scss", "output": "src/style" },
{ "input": "src/assets", "glob": "**/*", "output": "assets" },
Expand Down
1 change: 1 addition & 0 deletions packages/context/ng-package.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"allowedNonPeerDependencies": ["ts-md5"],
"assets": [
{ "input": "src", "glob": "*.scss", "output": "src" },
{ "input": "src", "glob": "**/*.them*.scss", "output": "src" },
{ "input": "src/style", "glob": "**/*.scss", "output": "src/style" },
{ "input": "src/assets", "glob": "**/*", "output": "assets" },
Expand Down
3 changes: 3 additions & 0 deletions packages/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"exports": {
".": {
"import": "./src/public_api.ts"
},
"./theming": {
"sass": "./src/context-theme.scss"
}
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"input": "src",
"glob": "*.scss",
"output": "",
"output": "src",
"ignore": ["*.import.scss"]
},
{ "input": "src", "glob": "**/*.them*.scss", "output": "src" },
Expand Down
2 changes: 1 addition & 1 deletion packages/core/ng-package.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"input": "src",
"glob": "*.scss",
"output": "",
"output": "src",
"ignore": ["*.import.scss"]
},
{ "input": "src", "glob": "**/*.them*.scss", "output": "src" },
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://github.com/infra-geo-ouverte/igo2-lib/issues"
},
"scripts": {
"prestart": "ts-node ../../scripts/src/core/prestart-core.ts",
"prestart": "npm run postbuild",
"build": "ng build core --configuration production",
"format": "prettier --write ./src/**/*.{ts,js,html,scss,css,json}",
"postbuild": "ts-node ../../scripts/src/core/postbuild-core.ts",
Expand All @@ -39,7 +39,7 @@
"sass": "./src/style/partial/*.scss"
},
"./theming": {
"sass": "./core-theme.scss"
"sass": "./src/core-theme.scss"
},
"./prebuilt-themes/*": {
"style": "./theming/prebuilt-themes/*.css"
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Theme bundles
@forward './theming/all-theme' show all-component-themes;

@forward './theming/typography';

// Workaround to allow styles sharing in production where the folder structure is different. We replace the file in a postbuild operation
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/theming/prebuilt-themes/blue-theme.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@use 'sass:map';
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$primary: mat.define-palette(mat.$blue-palette, 700, 400, 900);
$accent: mat.define-palette(mat.$blue-palette, 200);
$warn: mat.define-palette(mat.$red-palette);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-light-theme(
(
Expand All @@ -23,4 +24,4 @@ $theme: mat.define-light-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
7 changes: 4 additions & 3 deletions packages/core/src/theming/prebuilt-themes/bluedark-theme.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@use 'sass:map';
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$bluedark-palette: (
50: #e3eaec,
Expand Down Expand Up @@ -38,7 +39,7 @@ $bluedark-palette: (
$primary: mat.define-palette($bluedark-palette, 500);
$accent: mat.define-palette($bluedark-palette, 200);
$warn: mat.define-palette(mat.$red-palette);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-light-theme(
(
Expand All @@ -56,4 +57,4 @@ $theme: mat.define-light-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
7 changes: 4 additions & 3 deletions packages/core/src/theming/prebuilt-themes/bluedq-theme.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@use 'sass:map';
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$dq-palette: (
50: #e1f5fd,
Expand Down Expand Up @@ -38,7 +39,7 @@ $dq-palette: (
$primary: mat.define-palette($dq-palette, 900);
$accent: mat.define-palette($dq-palette, 500);
$warn: mat.define-palette(mat.$red-palette);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-light-theme(
(
Expand All @@ -56,4 +57,4 @@ $theme: mat.define-light-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
7 changes: 4 additions & 3 deletions packages/core/src/theming/prebuilt-themes/bluegrey-theme.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$primary: mat.define-palette(mat.$blue-grey-palette);
$accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
$warn: mat.define-palette(mat.$deep-orange-palette);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-light-theme(
(
Expand All @@ -22,4 +23,4 @@ $theme: mat.define-light-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
7 changes: 4 additions & 3 deletions packages/core/src/theming/prebuilt-themes/dark-theme.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$primary: mat.define-palette(mat.$blue-grey-palette);
$accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
$warn: mat.define-palette(mat.$deep-orange-palette);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-dark-theme(
(
Expand All @@ -22,4 +23,4 @@ $theme: mat.define-dark-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$primary: mat.define-palette(mat.$deep-purple-palette);
$accent: mat.define-palette(mat.$amber-palette, A200, A100, A400);
$warn: mat.define-palette(mat.$red-palette);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-light-theme(
(
Expand All @@ -22,4 +23,4 @@ $theme: mat.define-light-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
7 changes: 4 additions & 3 deletions packages/core/src/theming/prebuilt-themes/indigo-theme.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$primary: mat.define-palette(mat.$indigo-palette);
$accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
$warn: mat.define-palette(mat.$red-palette);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-light-theme(
(
Expand All @@ -22,4 +23,4 @@ $theme: mat.define-light-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
7 changes: 4 additions & 3 deletions packages/core/src/theming/prebuilt-themes/orange-theme.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@use '@angular/material' as mat;
@use '../../index' as igo;
@use '../all-theme';
@use '../typography';

$primary: mat.define-palette(mat.$orange-palette, 800);
$accent: mat.define-palette(mat.$light-blue-palette, 600, 100, 800);
$warn: mat.define-palette(mat.$red-palette, 600);
$typography: igo.$igo-typography;
$typography: typography.$igo-typography;

$theme: mat.define-light-theme(
(
Expand All @@ -22,4 +23,4 @@ $theme: mat.define-light-theme(
@include mat.typography-hierarchy($typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
4 changes: 3 additions & 1 deletion packages/core/src/theming/prebuilt-themes/qcca-theme.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@use 'sass:map';
@use '@angular/material' as mat;
@use '../all-theme';
@use '../../' as igo;

@use './qcca';

// https://design.quebec.ca/a-propos-systeme-design
Expand Down Expand Up @@ -37,7 +39,7 @@ $theme: map.merge(
@include mat.typography-hierarchy(qcca.$typo-typography);
@include mat.all-component-themes($theme);

@include igo.all-component-themes($theme);
@include all-theme.all-component-themes($theme);
@include qcca.all-component-themes($theme);

@media (max-width: 1200px) {
Expand Down
Loading

0 comments on commit dd74269

Please sign in to comment.