Static GitHub Issues

[2342] Unable to update CSS variable with document.documentElement.style.setProperty

prev: install error :Cannot load the stats for nuxtjs
next: Possible to debug with breakpoints in Visual Studio Code?

In nuxt.config.js

module.exports = {
	/*
	** other things
	*/
        css: [
                '@/assets/css/global.css
        ]
}

In global.css

:root {
	--color: green;
}
.color {
	color: var(--color);
}

In /pages/dummy.vue

<template>
	<section>
		<p class="color">DUMMY</p>
	</section>
</template>

<script>
export default {
	mounted () {
		this.$nextTick(() => {
			document.documentElement.style.setProperty('--color', 'blue')
		})
	}
}
</script>

Expect text to be blue, but it is green

In dev tool: image

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2044">#c2044</a>)</em></sub></div>