Skip to content

Commit d71e84b

Browse files
authored
Merge pull request element-hq#8159 from vector-im/jryans/versioned-img-urls
Use content hashing for font and image URLs
2 parents e3d807b + aa388f1 commit d71e84b

12 files changed

Lines changed: 670 additions & 203 deletions

File tree

‎package-lock.json‎

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

‎package.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"build:res": "node scripts/copy-res.js",
3434
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
3535
"build:compile": "npm run reskindex && babel --source-maps -d lib src",
36-
"build:bundle": "cross-env NODE_ENV=production webpack-cli -p --progress --bail --mode production",
37-
"build:bundle:dev": "webpack-cli --progress --bail --mode development",
36+
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production",
37+
"build:bundle:dev": "webpack --progress --bail --mode development",
3838
"build:electron": "npm run clean && npm run build && npm run install:electron && build -wml --ia32 --x64",
3939
"build:react-sdk": "node scripts/npm-sub.js matrix-react-sdk run build",
4040
"build:js-sdk": "node scripts/npm-sub.js matrix-js-sdk run start:init",
@@ -100,6 +100,7 @@
100100
"concurrently": "^4.0.1",
101101
"cpx": "^1.3.2",
102102
"cross-env": "^4.0.0",
103+
"css-loader": "^2.1.0",
103104
"electron-builder": "^20.29.0",
104105
"electron-builder-squirrel-windows": "^11.6.1",
105106
"electron-devtools-installer": "^2.2.4",
@@ -110,6 +111,7 @@
110111
"eslint-plugin-flowtype": "^2.50.3",
111112
"eslint-plugin-react": "^7.11.1",
112113
"expect": "^1.16.0",
114+
"file-loader": "^3.0.1",
113115
"fs-extra": "^0.30.0",
114116
"html-webpack-plugin": "^3.2.0",
115117
"json-loader": "^0.5.3",
@@ -136,7 +138,6 @@
136138
"postcss-scss": "^1.0.6",
137139
"postcss-simple-vars": "^4.1.0",
138140
"postcss-strip-inline-comments": "^0.1.5",
139-
"raw-loader": "^0.5.1",
140141
"react-addons-perf": "^15.4.0",
141142
"react-addons-test-utils": "^15.6.0",
142143
"rimraf": "^2.4.3",

‎res/home.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h2>_t("Decentralised, encrypted chat &amp; collaboration powered by [matrix]")<
130130
<div>
131131
<h3>_t("Search the room directory")</h3>
132132
<a class="mx_HomePage_room" href="#/directory">
133-
<img class="mx_HomePage_icon" src="img/icons-directory.svg">
133+
<img class="mx_HomePage_icon" src="home/images/icons-directory.svg">
134134
</a>
135135
<span class="mx_HomePage_comment">
136136
_t("Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!")
Lines changed: 24 additions & 0 deletions
Loading

‎res/themes/status/css/_StatusLogin.scss‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ limitations under the License.
100100
font-size: 16px;
101101
line-height: 25px;
102102
background-color: $form-bg-color;
103-
background-image: url(../../themes/status/img/dot.svg);
104-
box-shadow: 0px 5px 16px 0px rgba(25,12,46,0.16);
103+
background-image: url("$(status)/img/dot.svg");
104+
box-shadow: 0px 5px 16px 0px rgba(25,12,46,0.16);
105105
position: relative;
106106
text-align: center;
107107
}

‎res/themes/status/css/_fonts.scss‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@font-face {
2+
font-family:PostGrotesk-Medium;
3+
src:url('https://status.im/fonts/PostGrotesk-Medium.eot');
4+
src:url('https://status.im/fonts/PostGrotesk-Medium.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Medium.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Medium.svg#PostGrotesk-Medium') format("svg");
5+
font-weight: 400;
6+
font-style: normal;
7+
}
8+
9+
@font-face {
10+
font-family:PostGrotesk-Book;
11+
src:url('https://status.im/fonts/PostGrotesk-Book.eot');
12+
src:url('https://status.im/fonts/PostGrotesk-Book.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Book.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Book.svg#PostGrotesk-Book') format("svg");
13+
font-weight: 400;
14+
font-style: normal;
15+
}

‎res/themes/status/css/_paths.scss‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Path from root SCSS file (such as `status.scss`) to `res` dir in `matrix-react-sdk`
2+
$res: ../../../../node_modules/matrix-react-sdk/res;
3+
4+
// Path from root SCSS file (such as `status.scss`) to `status` dir in `riot-web`
5+
$status: ..;

‎res/themes/status/css/_status.scss‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
@font-face {
2-
font-family:PostGrotesk-Medium;
3-
src:url('https://status.im/fonts/PostGrotesk-Medium.eot');
4-
src:url('https://status.im/fonts/PostGrotesk-Medium.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Medium.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Medium.svg#PostGrotesk-Medium') format("svg");
5-
font-weight: 400;
6-
font-style: normal;
7-
}
8-
9-
@font-face {
10-
font-family:PostGrotesk-Book;
11-
src:url('https://status.im/fonts/PostGrotesk-Book.eot');
12-
src:url('https://status.im/fonts/PostGrotesk-Book.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Book.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Book.svg#PostGrotesk-Book') format("svg");
13-
font-weight: 400;
14-
font-style: normal;
15-
}
16-
171
// We deliberately prioritise Arial over Helvetica here due to diacritic problems (see _base.scss)
182
// N.B. that the status.im website uses:
193
// font-family:PostGrotesk-Book,-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
@@ -203,8 +187,8 @@ $event-redacted-border-color: #cccccc;
203187
// event timestamp
204188
$event-timestamp-color: #acacac;
205189

206-
$edit-button-url: "../../img/icon_context_message.svg";
207-
$copy-button-url: "../../img/icon_copy_message.svg";
190+
$edit-button-url: "$(res)/img/icon_context_message.svg";
191+
$copy-button-url: "$(res)/img/icon_copy_message.svg";
208192

209193
// e2e
210194
$e2e-verified-color: #76cfa5; // N.B. *NOT* the same as $accent-color

‎res/themes/status/css/status.scss‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import "_paths.scss";
2+
@import "_fonts.scss";
13
@import "../../../../node_modules/matrix-react-sdk/res/themes/light/css/_base.scss";
24
@import "_status.scss";
35
@import "../../../../node_modules/matrix-react-sdk/res/css/_components.scss";

‎scripts/copy-res.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ const COPY_LIST = [
5353
["res/home.html", "webapp"],
5454
["res/home-status.html", "webapp"],
5555
["res/home/**", "webapp/home"],
56-
["res/vector-icons/**", "webapp/vector-icons"],
57-
["node_modules/matrix-react-sdk/res/{fonts,img,themes,media}/**", "webapp"],
5856
["res/themes/**", "webapp/themes"],
57+
["res/vector-icons/**", "webapp/vector-icons"],
58+
["node_modules/matrix-react-sdk/res/media/**", "webapp/media"],
5959
["node_modules/emojione/assets/svg/*", "webapp/emojione/svg/"],
6060
["node_modules/emojione/assets/png/*", "webapp/emojione/png/"],
6161
// XXX: This is tied quite heavily to the matching olm.js so it really should be

0 commit comments

Comments
 (0)