Remove front matter from CSS files
What does this MR do and why?
Removes front matter from all stylesheets. These have a version
attribute, like this:
---
version: 11
---
which is appended to the filename when referenced on HTML pages, like this:
<link rel="stylesheet" href="/assets/stylesheets/footer-v11.css">
This was probably intended to force browsers to fetch the new, uncached version of the file after a deploy.
However, this is not necessary because GitLab Pages sets a cache-control
header, which expires cache after 5 minutes:
$ curl -I https://docs.gitlab.com/assets/stylesheets/footer-v11.css
HTTP/2 200
cache-control: max-age=600
content-type: text/css; charset=utf-8
etag: "2e16f274ecd572c2749020abb961787a70c574ab7d5cbd7808a84cd8926d04ca"
expires: Tue, 15 Nov 2022 20:07:09 UTC
last-modified: Tue, 15 Nov 2022 19:16:45 GMT
permissions-policy: interest-cohort=()
vary: Origin
content-length: 170
date: Tue, 15 Nov 2022 19:57:09 GMT
The version workaround may have been in place before GitLab Pages added the cache header (gitlab-pages#69 (closed)).
So, let's remove all of this stuff, because:
- it's not necessary any more
- it complicates using stylelint and in-editor linting tools
- removing this will simplify a future move to a better SCSS preprocessor (#1300 (closed))
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md. -
Verify the site compiles: bundle exec nanoc compile
-
Verify the site still loads CSS as expected (no visual differences, no console errors)
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.