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.

[Documentation] The import needs to be after the variables

See original GitHub issue

Environment

Browsers: Chrome 75.0.3770.142 OS: Windows 10

Steps to reproduce

$grid-breakpoints: (
  'xs': 0,
  'sm': 576px,
  'md': 768px,
  'lg': 992px,
  'xl': 1200px
);

@import '~vuetify/src/styles/styles.sass';

Expected Behavior

The breakpoint changed!

Actual Behavior

If I write like the documentation , don’t work

Reproduction Link

https://vuetifyjs.com/es-MX/customization/sass-variables

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:25 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
hereiscasiocommented, Sep 10, 2020

@DimosthenisK I finally find the problem

the key is treeShake it only works in production if i not manually setup it to ‘true’ customVariables only work in treeShake mode

thx man really appreciate it ❗️

1reaction
DimosthenisKcommented, Sep 10, 2020

@hereiscasio You also need to set the breakpoints in the nuxt config:

vuetify: {
    treeShake: true,
    customVariables: ['~/assets/variables.scss'],
    breakpoint: {
        thresholds: {
            xs: 0,
            sm: 425,
            md: 768 + 16,
            lg: 1024 + 16
        }
    }
}

My variables.scss looks currently like this:

@import '~vuetify/src/styles/tools/_functions.sass';
@import '~vuetify/src/styles/styles.sass';

$grid-breakpoints: map-deep-merge(
    $grid-breakpoints,
    (
        'xs': 0,
        'sm': 425px,
        'md': 768px,
        'lg': 1024px,
        'xl': 1920px
    )
);

/* prettier-ignore */
$display-breakpoints: map-deep-merge(
    $display-breakpoints,
    (
        'print-only': 'only print',
        'screen-only': 'only screen',
        'xs-only': 'only screen and (max-width: #{map-get($grid-breakpoints, 'sm') - 1})',
        'sm-only': 'only screen and (min-width: #{map-get($grid-breakpoints, 'sm')}) and (max-width: #{map-get($grid-breakpoints, 'md') - 1})',
        'sm-and-down': 'only screen and (max-width: #{map-get($grid-breakpoints, 'md') - 1})',
        'sm-and-up': 'only screen and (min-width: #{map-get($grid-breakpoints, 'sm')})',
        'md-only': 'only screen and (min-width: #{map-get($grid-breakpoints, 'md')}) and (max-width: #{map-get($grid-breakpoints, 'lg') - 1})',
        'md-and-down': 'only screen and (max-width: #{map-get($grid-breakpoints, 'lg') - 1})',
        'md-and-up': 'only screen and (min-width: #{map-get($grid-breakpoints, 'md')})',
        'lg-only': 'only screen and (min-width: #{map-get($grid-breakpoints, 'lg')}) and (max-width: #{map-get($grid-breakpoints, 'xl') - 1})',
        'lg-and-down': 'only screen and (max-width: #{map-get($grid-breakpoints, 'xl') - 1})',
        'lg-and-up': 'only screen and (min-width: #{map-get($grid-breakpoints, 'lg')})',
        'xl-only': 'only screen and (min-width: #{map-get($grid-breakpoints, 'xl')})'
    )
);

@import '~vuetify/src/styles/settings/_variables';

Read more comments on GitHub >

github_iconTop Results From Across the Web

5. The import system — Python 3.11.1 documentation
The import statement combines two operations; it searches for the named module, then it binds the results of that search to a name...
Read more >
import - JavaScript - MDN Web Docs - Mozilla
In order to use the import declaration in a source file, the file must be interpreted by the runtime as a module. In...
Read more >
Python import: Advanced Techniques and Tips
In Python, you use the import keyword to make code in one module available in another. Imports in Python are important for structuring...
Read more >
Command: import | Terraform - HashiCorp Developer
The terraform import command brings existing resources into Terraform state.
Read more >
Documentation - Modules - TypeScript
declared in a module are not visible outside the module unless they are explicitly exported using one of the export forms. Conversely, to...
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