Skip to content

Commit

Permalink
fix(netlify-cms-plugin): remove preview styles from global context (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
erezrokah authored and GatsbyJS Bot committed Jan 9, 2020
1 parent 6ffd037 commit a4e5fb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/gatsby-plugin-netlify-cms/src/cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ if (PRODUCTION) {
*/
window.addEventListener(`DOMContentLoaded`, event => {
const list = document.querySelectorAll(`link[rel='stylesheet']`)
list.forEach(({ href }) => {
CMS.registerPreviewStyle(href)
list.forEach(link => {
CMS.registerPreviewStyle(link.href)
// remove the preview style from the CMS context
link.parentNode.removeChild(link)
})
})
}

0 comments on commit a4e5fb9

Please sign in to comment.