Files
.github
.husky
docs
scripts
assets
nodes
footer.mjs
header.mjs
htmlTagAddAttri.mjs
logo.mjs
style
utils
build.mjs
create.mjs
index.mjs
watch.mjs
.dockerignore
.editorconfig
.gitattributes
.gitignore
.lintstagedrc
.markdownlint.json
.prettierignore
.prettierrc
CONTRIBUTING.md
Dockerfile
LICENSE
README.md
package.json
renovate.json
reference/scripts/nodes/htmlTagAddAttri.mjs

9 lines
241 B
JavaScript
Raw Normal View History

2022-09-27 23:09:51 +08:00
export function htmlTagAddAttri(node, { isHome }) {
2022-09-26 17:13:24 +08:00
if (node && node.tagName === 'html') {
node.properties['data-color-mode'] = 'dark';
}
2022-09-27 23:09:51 +08:00
if (node && node.tagName === 'body' && isHome) {
node.properties.class = ['home'];
}
2022-10-29 00:24:39 +08:00
}