Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Fix errors with scoped modules #154

Merged
merged 1 commit into from
Dec 8, 2016
Merged

Fix errors with scoped modules #154

merged 1 commit into from
Dec 8, 2016

Conversation

danieldiekmeier
Copy link
Contributor

I noticed some problems with the scoped modules, especially when using Watchify and the extract-css plugin.

These bugs do not occur when restarting Browserify before every render, but get really annoying when using Watchify and keeping the program state around.

There were two bugs that his Pull Request addresses:

  1. When changing nothing except the scoped attribute on a <style> tag, the CSS would not get updated. This is because the value of scoped wasn't part of the cache key. I fixed that by simply adding the scoped variable to the key.

  2. When Watchify did another bundling, the addId PostCSS plugin from lib/style-rewriter.js got added another time, but didn't get removed if the component was not scoped. This led to multiple [data-v-x] ids on selectors as well as ids on selectors that shouldn't even be scoped. For example:

.Menu[data-v-3][data-v-3][data-v-3] {
  display: flex;
}

I fixed that by ensuring the plugins array only has a maximum of 1 addId function, and by removing the function if the component is not scoped.

@yyx990803 yyx990803 merged commit f25fb22 into vuejs:master Dec 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants