Skip to content

Commit 13aa6e8

Browse files
authored
Use more specific names for the version picker CSS classes and add them to the PurgeCSS safelist (#2264)
1 parent 705240d commit 13aa6e8

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

assets/js/versions.template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ function appendVersion(parent, name, segment, url) {
4444
// The list item
4545
const li = document.createElement("li");
4646
if (segment === selected) {
47-
li.classList.add("selected");
47+
li.classList.add("version-picker-selected");
4848
}
4949
if (segment === "latest") {
50-
li.classList.add("latest");
50+
li.classList.add("version-picker-latest");
5151
}
5252
parent.appendChild(li);
5353

assets/scss/_styles_project.scss

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,13 @@ Custom SCSS for the Matrix spec
5757
overflow-y: auto;
5858
}
5959

60-
/* As these styles are only applied by JavaScript, PurgeCSS doesn't see them
61-
* in the source code and removes them unless we explicitly tell it not to.
62-
*/
63-
/* purgecss start ignore */
64-
ul#version-selector li.selected a {
60+
ul#version-selector li.version-picker-selected a {
6561
font-weight: bold;
6662
}
6763

68-
ul#version-selector li.latest a {
64+
ul#version-selector li.version-picker-latest a {
6965
color: $secondary;
7066
}
71-
/* purgecss end ignore */
7267
}
7368

7469
/* Styles for the sidebar nav */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add version picker in the navbar.

postcss.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const purgecss = require('@fullhuman/postcss-purgecss')({
1616
extensions: ["json"],
1717
},
1818
],
19+
// As these classes are only applied by JavaScript, PurgeCSS doesn't see them
20+
// in the source code and removes them unless we explicitly tell it not to.
21+
safelist: ['version-picker-selected', 'version-picker-latest']
1922
});
2023

2124
module.exports = {

0 commit comments

Comments
 (0)