Skip to content

Commit 4b75828

Browse files
authored
Merge pull request #236 from GetStream/encapsulate-stream-chat-css
Encapsulate stream chat css
2 parents e5b5f87 + 0dad67f commit 4b75828

File tree

8 files changed

+252
-8
lines changed

8 files changed

+252
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ Thumbs.db
5454

5555
# Angular environment.ts
5656
/**/environments/environment.ts
57+
58+
# Encapsulated stream-chat-css
59+
projects/stream-chat-angular/src/assets/styles

docusaurus/docs/Angular/basics/upgrade-v2.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ id: upgrade-v2
33
title: Upgrade from v2
44
---
55

6+
## Peer dependencies
7+
8+
### stream-chat-css
9+
10+
You can drop the `@stream-io/stream-chat-css` dependency because going forward `stream-chat-angular` will encapsulate the library.
11+
12+
Rewrite your stylesheet imports to this:
13+
14+
`~stream-chat-angular/src/assets/styles/scss/index.scss`
15+
16+
Or this if you were using CSS:
17+
18+
`~stream-chat-angular/src/assets/styles/css/index.css`
19+
20+
It's still possible to individually import stylesheets you just have to replace the `~@stream-io/stream-chat-css/dist` prefix with `~stream-chat-angular/src/assets/styles`.
21+
622
## Inputs removed in favor of channel capabilities
723

824
The following inputs are removed:

package-lock.json

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

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"scripts": {
55
"prepare": "husky install",
6-
"postinstall": "npm run config:dev",
6+
"postinstall": "npm run config:dev & npm run copy-css",
77
"ng": "ng",
88
"prestart": "npm run config:dev && ng build",
99
"start": "ng serve sample-app",
@@ -12,7 +12,7 @@
1212
"start:dev": "rm -rf dist & npm run watch & (wait-on dist && ng serve sample-app)",
1313
"start:dev:customizations-example": "rm -rf dist & npm run watch & (wait-on dist && ng serve customizations-example)",
1414
"build": "ng build",
15-
"build:prod": "ng build --configuration production",
15+
"build:prod": "npm run copy-css && ng build --configuration production",
1616
"watch": "ng build --watch --configuration development",
1717
"test": "rm -rf dist & npm run watch & (wait-on dist && ng run stream-chat-angular:test)",
1818
"test:ci": "ng run stream-chat-angular:test --browsers ChromeHeadlessCustom --watch false",
@@ -31,7 +31,8 @@
3131
"generate-docs": "npm run typedoc:services && npm run typedoc:components && npm run copy-docs",
3232
"typedoc:services": "typedoc --cleanOutputDir true --excludeConstructors true --hideBreadcrumbs true --hideInPageTOC true --excludePrivate true --out temp-service-docs --exclude '!**/*service.ts' --excludeNotDocumented --tsconfig projects/stream-chat-angular/tsconfig.lib.json projects/stream-chat-angular/src/public-api.ts",
3333
"typedoc:components": "typedoc --cleanOutputDir true --excludeConstructors true --sort source-order --hideBreadcrumbs true --hideInPageTOC true --excludePrivate true --excludeNotDocumented --out temp-component-docs --exclude '!**/*component.ts' --tsconfig projects/stream-chat-angular/tsconfig.lib.json projects/stream-chat-angular/src/public-api.ts",
34-
"copy-docs": "ts-node copy-generated-service-docs.ts & (ts-node remove-generated-component-docs-content && ts-node copy-generated-component-docs.ts)"
34+
"copy-docs": "ts-node copy-generated-service-docs.ts & (ts-node remove-generated-component-docs-content && ts-node copy-generated-component-docs.ts)",
35+
"copy-css": "copyfiles --up 4 \"node_modules/@stream-io/stream-chat-css/dist/**/*\" projects/stream-chat-angular/src/assets/styles"
3536
},
3637
"lint-staged": {
3738
"**/*": [
@@ -121,6 +122,7 @@
121122
"@types/jasmine": "~3.8.0",
122123
"@typescript-eslint/eslint-plugin": "4.28.2",
123124
"@typescript-eslint/parser": "4.28.2",
125+
"copyfiles": "^2.4.1",
124126
"cypress": "8.4.0",
125127
"eslint": "^7.32.0",
126128
"eslint-config-prettier": "^8.3.0",

projects/customizations-example/src/styles.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "~@stream-io/stream-chat-css/dist/scss/index.scss";
1+
@import "../../stream-chat-angular/src/assets/styles/scss/index.scss";
22
@import "~@ctrl/ngx-emoji-mart/picker";
33
@import url(https://fonts.googleapis.com/icon?family=Material+Icons);
44

@@ -42,3 +42,7 @@ body {
4242
background-image: none !important;
4343
}
4444
}
45+
46+
.material-icons {
47+
font-family: "Material Icons" !important;
48+
}

projects/sample-app/src/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "~@stream-io/stream-chat-css/dist/scss/index.scss";
1+
@import "../../stream-chat-angular/src/assets/styles/scss/index.scss";
22
@import "~@ctrl/ngx-emoji-mart/picker";
33

44
body {

projects/stream-chat-angular/ng-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
33
"dest": "../../dist/stream-chat-angular",
4-
"assets": ["src/styles/**/*.scss", "src/assets/**/*"],
4+
"assets": ["src/assets/**/*"],
55
"lib": {
66
"entryFile": "src/public-api.ts"
77
},

projects/stream-chat-angular/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"@angular/common": "^12.2.0 || ^13.0.0",
1313
"@angular/core": "^12.2.0 || ^13.0.0",
1414
"@ngx-translate/core": "^13.0.0 || ^14.0.0",
15-
"stream-chat": "^4.3.0 || ^5.0.0",
16-
"@stream-io/stream-chat-css": "2.6.0"
15+
"stream-chat": "^4.3.0 || ^5.0.0"
1716
},
1817
"dependencies": {
1918
"angular-mentions": "^1.4.0",

0 commit comments

Comments
 (0)