Skip to content

Commit

Permalink
Update rethemendex.sh
Browse files Browse the repository at this point in the history
This commit updates rethemendex.sh, so that any CSS files in "_sc" folder are excluded from being included to alphabetic sorting which causes cascading mess, ensuring `_customization.pcss` is imported at the end of the file.

This also removes warning message from README.md as this update takes care of importing our CSS files.
  • Loading branch information
luixxiul committed Mar 1, 2024
1 parent 48a4007 commit d5900bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion res/css/_sc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Even if the properties are styled with `!important` by the upstream to cover reg

The way in which the upstream project generates concatenated CSS files has been very stable (essentially same since at least 2018. See: https://github.com/matrix-org/matrix-react-sdk/commits/develop/res/css/rethemendex.sh), so we should be able to depend on the current way how it works for a reasonable time.

**Warning: running `rethemendex` breaks cascading!** Manual editing is required for now.
**Please do not forget to update `_customization.pcss`** if you have added other CSS files for customization. Please mind where to import the files as it affects how styles cascade. Never import them alphabetically.
2 changes: 2 additions & 0 deletions res/css/_sc/_customization.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ limitations under the License.
*/

/* TODO: replace @import with @mixin once multiple CSS files are created for customization in order to keep styling modular */
/* Please mind where to import CSS files as it affects how styles cascade. */

@import "./views/rooms/_EventTile.pcss";
@import "./views/rooms/_IRClayout.pcss";
11 changes: 10 additions & 1 deletion res/css/rethemendex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ cd `dirname $0`
# we used to have exclude /themes from the find at this point.
# as themes are no longer a spurious subdirectory of css/, we don't
# need it any more.
find . -iname _\*.pcss | fgrep -v _components.pcss | LC_ALL=C sort |
#
# Exclude "_sc" folder dedicated for our custom CSS files from being included
# to alphabetic sorting which causes cascading mess. Please note that CSS files
# inside the folder are imported at the end.
find . -iname _\*.pcss -not -path "./_sc/*" | fgrep -v _components.pcss | LC_ALL=C sort |
while read i; do
echo "@import \"$i\";"
done

# Import the CSS file dedicated for customization to let our declarations
# inside it override the styles specified by the upstream project.
echo "\n/* Customization for SchildiChat */";
echo "@import \"./_sc/_customization.pcss\";";
} > _components.pcss

0 comments on commit d5900bf

Please sign in to comment.