Vue.js => style tags are rendered twice
See original GitHub issueThank you for a nice plugin!
When using with Vue.js, the plugin, unfortunately, inlines the <style>
tags from Vue.js single file components twice.
Please let me know, if such behavior is intended and the only choices for now are to either remove the duplicates by running regex on them:
postProcessHtml: function (context) {
return context.html.replace(
/(<style(.*?)<\/style>)/i,
''
)
}
or to extract css in a separate file.
I’m currently using the regex method, but please let me know, if there is a way to not duplicate the <style>
tags.
Also, if you need a reproduction repo, I could quickly prepare that as well, if there’s a need for it.
Thank you very much!
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Template renders twice in vue.js - Stack Overflow
Your template is and will be rendered multiple times - simply every time some of the reactive data it uses changes... You don't...
Read more >Entry point rendered twice - Get Help - Vue Forum
In my app, the main App container is being rendered twice when I do a manual refresh of the page. I added a...
Read more >[Solved]-Vue dynamic component renders twice-Vue.js
[Solved]-Vue dynamic component renders twice-Vue.js. Search. score:5 ... You have two <slot></slot> tags in DashboardItem.vue . Remove one ;).
Read more >Rendering a list of Vue components - Learn web development
Vue components are written as a combination of JavaScript objects that ... v-for attaches to the element you want to repeat, and renders...
Read more >How to Implement DFP (DoubleClick for Publishers) in React ...
How to Implement DFP (DoubleClick for Publishers) in React.js, Vue.js, and AMP? ... define ad slot, render ad element and display ads.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is normal. It is similar to issues #105 and (loosely) #107.
Your endpoints are rendering and capturing the HTML verbatim. If Vue injects more on dynamic mount, it will be duplicate
<style>
markup.Use
postProcessHtml
to sanitize your HTML into one unique set of CSS or JSS markup.From the README doc:
I have the same problem (I think). The spa-plugin does not add the styles twice, but they are added again by Vue when you mount on top of the prerendered dom.