ktsn / vue-template-loader

Vue.js 2.0 template loader for webpack
MIT License
266 stars 26 forks source link

Scoped CSS and SSR #24

Closed hworld closed 7 years ago

hworld commented 7 years ago

I've been trying to set up server side rendering for my Vue project with scoped CSS. It seems to be failing on loading in the scoped styles through the loader included in the lib folder of the project. Something about super.apply can't be called?

However, the second issue that I see coming up is possible ID mismatches. I believe it generates IDs by just incrementing a global var and assigning it to the filename. If the server side rendered bundle differs in the number of components loaded in (or loads them in a different order) I believe it will change the IDs assigned to the component and the data attributes will no longer match the CSS from the browser CSS bundle.

What do you think about changing it to a hash of the filename for the component instead? I believe this would stay consistent across both server bundle and the client bundle.

ktsn commented 7 years ago

I'll use hash for component id from the next version.

hworld commented 7 years ago

Yayyy! Thanks a bunch