mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-04-05 10:44:10 +02:00
Fix click-to-copy buttons for code blocks
It turns out that we were purging too much CSS which broke their style. We use a simple but lazy solution that parses the JS scripts and keeps the matching selectors. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
parent
6f1e64cb12
commit
646087cfb9
|
|
@ -1,11 +1,21 @@
|
||||||
// Remove unused CSS selectors.
|
// Remove unused CSS selectors.
|
||||||
const purgecss = require('@fullhuman/postcss-purgecss')({
|
const purgecss = require('@fullhuman/postcss-purgecss')({
|
||||||
// Use stats generated by Hugo.
|
content: [
|
||||||
content: [ './hugo_stats.json' ],
|
// Use stats generated by Hugo from HTML content.
|
||||||
defaultExtractor: (content) => {
|
'./hugo_stats.json',
|
||||||
let els = JSON.parse(content).htmlElements;
|
// Add used JS scripts.
|
||||||
return els.tags.concat(els.classes, els.ids);
|
process.env.HUGO_PUBLISHDIR + '/js/click-to-copy.js',
|
||||||
}
|
process.env.HUGO_PUBLISHDIR + '/js/main.js',
|
||||||
|
],
|
||||||
|
extractors: [
|
||||||
|
{
|
||||||
|
extractor: (content) => {
|
||||||
|
let els = JSON.parse(content).htmlElements;
|
||||||
|
return els.tags.concat(els.classes, els.ids);
|
||||||
|
},
|
||||||
|
extensions: ["json"],
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue