Files
.github
docs
scripts
assets
nodes
footer.mjs
header.mjs
htmlTagAddAttri.mjs
logo.mjs
utils
build.mjs
create.mjs
index.mjs
style.css
watch.mjs
.gitignore
CONTRIBUTING.md
LICENSE
README.md
package.json
renovate.json
reference/scripts/nodes/htmlTagAddAttri.mjs

8 lines
240 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-09-26 17:13:24 +08:00
}