[meta] Stop using the preprocessor for CSS
Categories
(Toolkit :: Themes, task, P5)
Tracking
()
People
(Reporter: bgrins, Unassigned)
Details
(Keywords: meta)
With a combination of @import and CSS variables I think this shouldn't be technically needed anymore. Having the preprocessor directives confuse tooling and make it harder to map line numbers back to rules in devtools and (potentially) CSS coverage tools. Rather than adding source map support to the preprocessor, I think we should work on reducing reliance on the preprocessor here and ultimately removing it.
Here are some searches showing common usage of the preprocessor:
Reporter | ||
Comment 1•5 years ago
|
||
This came up in the context of potentially adding CSS code coverage to our ccov jobs. We do have a way to work around the preprocessor for JS code coverage, so we could do something similar if needed:
We have a similar situation with JavaScript files. The JS engine is
producing raw files, and we have a "rewriter" tool which fixes paths and
lines according to preprocessor information.
https://searchfox.org/mozilla-central/rev/f8b11433159cbc9cc80500b3e579d767473fa539/python/mozbuild/mozbuild/codecoverage/lcov_rewriter.py
https://searchfox.org/mozilla-central/rev/f8b11433159cbc9cc80500b3e579d767473fa539/python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py
Reporter | ||
Comment 2•5 years ago
|
||
Here are the consumes of the preprocessor in our CSS files: https://searchfox.org/mozilla-central/search?q=%5E%25®exp=true&path=.css
Comment 3•5 years ago
|
||
CSS variables can add runtime overhead, which is why we prefer defines when the values aren't supposed to change.
Reporter | ||
Comment 4•5 years ago
|
||
(In reply to Dão Gottwald [::dao] from comment #3)
CSS variables can add runtime overhead, which is why we prefer defines when the values aren't supposed to change.
Sure, there's a trade off here in order to more easily use existing tooling (for things like code coverage and devtools line number mapping). In theory we could add source map exporting to the preprocessor to help, but I'd prefer to rely on existing standards when possible.
Is there a measurable performance impact to using incrementally more variables? It looks like we already have ~75 on the :root element in browser.xhtml and I'm not aware of reports related to this from the perf team. I just did some searching around and the only bugs I found are:
- Bug 1362593 to add a test to measure performance which hasn't had any attention (which is maybe a sign that this just hasn't come up in practice)
- Bug 1417970, but this is related to when properties change, which they wouldn't here
Updated•5 years ago
|
Reporter | ||
Comment 5•4 years ago
|
||
I see this is being picked up in Bug 1659444
Updated•3 years ago
|
Description
•