-
-
Notifications
You must be signed in to change notification settings - Fork 832
Load fonts and images via source-relative URLs and requires #2460
Conversation
This means that themes which include `light/css/_base.scss` (currently Dark and Status) won't be forced to have Light's font-faces included. This only really matters for Status, which uses different fonts throughout.
Adds a `$res` SCSS variable set to the path from the root SCSS file to the `res` directory. This is a different base path than previously used in CSS URLs (it goes up 3 directories instead of 2), because Webpack will now be resolving images relative to the root SCSS file, so the path corresponds to a source tree location, instead of a path in the build output tree. Defining this variable has two main goals: * URLs are a bit easier to read * The path can be overridden, which is needed for external (riot-web) themes
I am about to run some code replacements that might make lines too long, so with this change I know we're starting from 0 line length warnings.
This allows Webpack to insert the proper image URL after builds steps like adding a hash and so on. The path you supply to `require` is relative to the JS source file, just like any other would be.
I think CI is confused here, so I am going to ignore it and request review. I'll make sure everything works as expected before merging. |
The Edit: to fix the |
Removing review request for now. There are still a few issues with Karma tests to fix. |
Karma issues resolved and CI is green now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a couple unrelated linting fixes landed here too, but they also look reasonable.
As part of adding versioned URLs in element-hq/element-web#7932, we need to convert all image references to flow through the build system.
This is a change that everyone on the team should be aware of, as it affects how image paths are written. In particular:
./res/themes/dharma/css/dharma.scss
$(res)
helper variable has been defined so we can writeurl('$(res)/img/cancel.svg')
while still supporting themes in different places (such as Status inriot-web
)Needed for element-hq/element-web#7932
Used in element-hq/element-web#8159