question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

globalVueStyles doesn't work

See original GitHub issue
  • Laravel Mix Version: #.#.# (npm list --depth=0) ── axios@0.21.1 ├── bootstrap@4.6.0 ├── css-loader@5.1.2 ├── jquery@3.6.0 ├── laravel-mix@6.0.13 ├── lodash@4.17.21 ├── node-sass@5.0.0 ├── popper.js@1.16.1 ├── postcss@8.2.8 ├── resolve-url-loader@2.3.2 ├── sass@1.32.8 ├── sass-loader@11.0.1 ├── vue@2.6.12 ├── vue-loader@15.9.6 ├── vue-style-loader@4.1.3 └── vue-template-compiler@2.6.12

  • Node Version (node -v):

  • v13.12.0

  • NPM Version (npm -v):

  • 6.14.8

  • OS: MacOS Big Sur version 11.2.1

Description:

globalVueStyles is not working

webpack.mix.js: const mix = require(‘laravel-mix’); var path = require(‘path’);

mix.js(‘resources/js/app.js’, ‘public/js’) .vue() .sass(‘resources/sass/app.scss’, ‘public/css’) .options({ extractVueStyles: true, globalVueStyles: ‘resources/sass/_variables.scss’, }) .version();

package.json: { “private”: true, “scripts”: { “dev”: “npm run development”, “development”: “mix”, “watch”: “mix watch”, “watch-poll”: “mix watch – --watch-options-poll=1000”, “hot”: “mix watch --hot”, “prod”: “npm run production”, “production”: “mix --production” }, “devDependencies”: { “axios”: “^0.21”, “bootstrap”: “^4.0.0”, “css-loader”: “^5.1.2”, “jquery”: “^3.2”, “laravel-mix”: “^6.0.6”, “lodash”: “^4.17.19”, “node-sass”: “^5.0.0”, “popper.js”: “^1.12”, “postcss”: “^8.1.14”, “resolve-url-loader”: “^2.3.1”, “sass”: “^1.20.1”, “sass-loader”: “^11.0.1”, “vue”: “^2.5.17”, “vue-loader”: “^15.9.6”, “vue-style-loader”: “^4.1.3”, “vue-template-compiler”: “^2.6.10” } }

Steps To Reproduce:

Create a new laravel project and make sure node-sass and loaders are installed. The variables scss partial should already be created. add this to webpack.mix file mix.js(‘resources/js/app.js’, ‘public/js’) .vue() .sass(‘resources/sass/app.scss’, ‘public/css’) .options({ extractVueStyles: true, globalVueStyles: ‘resources/sass/_variables.scss’, }) .version(); and see if you can use one of the variables in that file in your vue component. don’t forget to add lang=“scss”

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

3reactions
thecrypticacecommented, Mar 18, 2021

This is because how we handle this changed in Mix v6: https://github.com/JeffreyWay/laravel-mix/blob/467f0c9b01b7da71c519619ba8b310422321e0d6/UPGRADE.md#vue-configuration

I’ll make a note to add some warnings for this.

1reaction
nathancallcommented, Mar 18, 2021

Same! This would be super helpful to sort out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

globalVueStyles doesn't work · Issue #2896 · laravel-mix ...
I have the same issue, I can't get globalVueStyles to work. Been looking for a clear answer for days.
Read more >
GlobalVueStyles: not working for global Sass in vue components
When I tried your solution it did not work. Here is how I managed to fix this issue, using this new/changed property additionalData, ......
Read more >
GlobalVueStyles - Laracasts
GlobalVueStyles. I don't really understand how to get this to work. I am trying to load a global sass variable file into my...
Read more >
Laravel Mix Options
globalVueStyles: Indicate a file to include in every component styles. ... This option only works when extractVueStyles is enabled.
Read more >
[Solved]-vue.config.js to (laravel) webpack.mix.js-Vue.js
mix.options({ globalVueStyles: `resources/assets/css/variables.scss` }); ... Also, the docs say that this option only works when extractVueStyles is enabled ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found