Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Project styles/variables.scss has no effect when a preset is used #222

Open
blaflamme opened this issue Dec 3, 2020 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@blaflamme
Copy link

Environment

Vuetify Version: 2.2.6
Vue Version: 2.6.11
Browsers: Google Chrome
OS: Mac OS 10.15.2

Steps to reproduce

  1. Create a test app and add Vuetify
$ vue create test-app
$ cd test-app
$ vue add vuetify
$ yarn serve

You should see the welcome Vuetify start page.

  1. Add a styles/variables.scss with a larger font size root:
$ mkdir src/styles; echo '$font-size-root: 18px;' > src/styles/variables.scss

At that point the default page should have a bigger font.

  1. Add a preset:
$ vue add vuetify-preset-crane
$ yarn serve

At that point the default page should have different colours and a new font, but the size of the font is wrong and back to 16px. Try to increase or decrease the font size and nothing is happening.

Expected Behavior

The project styles/variables.scss should be merged with default and preset variables, override them and be injected to produce the right output.

Actual Behavior

The file is never used if a preset is installed

Reproduction Link

https://github.com/blaflamme/vuetify-variables-bug-app

Other comments

I was able to do a temporary workaround by...

  1. Importing the preset variables in my project variables
# styles/variables.scss

@import "vue-cli-plugin-vuetify-preset-crane/preset/variables.scss";

$font-size-root: 18px;
  1. Add a rule config to chainWebpack
# vue.config.js

const { mergeSassVariables } = require("@vuetify/cli-plugin-utils")

module.exports = {
  transpileDependencies: ["vuetify"],
  chainWebpack: config => {
    const modules = ["vue-modules", "vue", "normal-modules", "normal"]
    modules.forEach(match => {
      config.module
        .rule("sass")
        .oneOf(match)
        .use("sass-loader")
        .tap(opt => mergeSassVariables(opt, `'@/styles/variables.scss'`))
      config.module
        .rule("scss")
        .oneOf(match)
        .use("sass-loader")
        .tap(opt => mergeSassVariables(opt, `'@/styles/variables.scss';`))
    })
  }
}
@johnleider johnleider self-assigned this Dec 3, 2020
@johnleider johnleider added the bug Something isn't working label Dec 3, 2020
@johnleider johnleider added this to the 2.1.x milestone Feb 3, 2021
@ElijahKotyluk ElijahKotyluk modified the milestones: 2.1.x, 2.4.x Jun 3, 2021
This issue is being transferred. Timeline may not be complete until it finishes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants