vikejs / vike-vue

🔨 Vue integration for Vike
https://vike.dev/vike-vue
MIT License
38 stars 6 forks source link

How to add some className to body? #143

Closed 7iomka closed 2 months ago

7iomka commented 3 months ago

How to add some className to body? For example I want initially to have dark class for tailwind dark theme by default for all my pages.

brillout commented 3 months ago

How about a new setting bodyAttributes:

// +config.js

export default {
  bodyAttributes: { class: 'dark' }
}

PR welcome in case that's something you'd have fun doing. Otherwise I'll implement it myself later today.

7iomka commented 3 months ago

How about a new setting bodyAttributes:

// +config.js

export default {
  bodyAttributes: { class: 'dark' }
}

PR welcome in case that's something you'd have fun doing. Otherwise I'll implement it myself later today.

Implementation on your side will be preferable, because I am a newbie here:) My general suggestion is to add bodyAttributes and htmlAttributes. In case of the html attrs of course you can add a class as well, but maybe need some extra work to omit lang and dir attributes from other configs. Thanks.

brillout commented 3 months ago

:+1: Will do tomorrow.

brillout commented 3 months ago

First PoC pre-released as 0.7.6-commit-40caee7.

7iomka commented 2 months ago

First PoC pre-released as 0.7.6-commit-40caee7.

How to use it?)

brillout commented 2 months ago

See the example in the PR.

7iomka commented 2 months ago

See the example in the PR.

I mean this version is not found when I tried to install it

brillout commented 2 months ago

https://www.npmjs.com/package/vike-vue/v/0.7.6-commit-40caee7

brillout commented 2 months ago

Implemented by https://github.com/vikejs/vike-vue/pull/169. I will release a new version in the coming days.