ZeeCoder / container-query

A PostCSS plugin and Javascript runtime combination, which allows you to write container queries in your CSS the same way you would write media queries.
MIT License
139 stars 4 forks source link

Vue Example #128

Open eulertour opened 4 years ago

eulertour commented 4 years ago

I couldn't figure out how to make this work with a vue (vue-cli) project. An example in the documentation would be extremely helpful.

ZeeCoder commented 4 years ago

Unfortunately I don't use vue, so not entirely sure how React's lifecycle methods translate there. It shouldn't be too hard though, all you need to do is to create a Container instance when a vue component "mounted" with the actual dom element. For react the key is componentDidMount: https://github.com/ZeeCoder/container-query/blob/master/packages/react-container-query/src/ContainerQuery.js

The hook version would be even simpler, I just never got around to finish it: https://github.com/ZeeCoder/container-query/commit/18dd21e11aa57e43b64f159621409eb9e0c6cf72#diff-ff42a97c4f3571a1d6e2a2652d6be6fa