Fix syntax highlighting and click-to-copy buttons for code blocks (#2049)
This commit is contained in:
parent
6f1e64cb12
commit
ba73e0d97a
2 changed files with 17 additions and 6 deletions
1
changelogs/internal/newsfragments/2049.clarification
Normal file
1
changelogs/internal/newsfragments/2049.clarification
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix syntax highlighting and click-to-copy buttons for code blocks by purging less CSS.
|
|
@ -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.min.*.js',
|
||||||
}
|
process.env.HUGO_PUBLISHDIR + '/js/main.min.*.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…
Add table
Add a link
Reference in a new issue