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

Guide for setting up with newest sass version? #236

Open
sinnbeck opened this issue Jan 13, 2025 · 1 comment
Open

Guide for setting up with newest sass version? #236

sinnbeck opened this issue Jan 13, 2025 · 1 comment

Comments

@sinnbeck
Copy link

sinnbeck commented Jan 13, 2025

I am trying to get this to work in the latest sass version (dart). I have one file with my breakpoints, but it seems that it does not pick it up.

I have this _breakpoints.scss file where I forward the include-media package.

$breakpoints: (
    mobile_portrait: 320px,
    mobile_landscape: 480px,
    tablet: 740px,
    desktop: 980px,
    wide: 1300px,
);

$media-expressions: (
    'screen': 'screen',
    'print': 'print',
    'handheld': 'handheld',
    'landscape': '(orientation: landscape)',
    'portrait': '(orientation: portrait)',
    'retina2x': '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)',
    'retina3x': '(-webkit-min-device-pixel-ratio: 3), (min-resolution: 350dpi)',
) !default;

$handheld_bp: 'portrait', 'landscape';

@forward "~include-media/dist/_include-media.scss";

I then use it in a different file

@use '../settings/breakpoints' as m;

@include m.media('>wide') {
    .header .headerLogo {
        width: 50%;
    }
}

But it seems to try and and parse wide instead of using the breakpoint instead of parsing it

SassError: "Invalid unit `wide`."
@sinnbeck
Copy link
Author

sinnbeck commented Jan 13, 2025

I got it working, but I am unsure if its correct. In my entrypoint I load it once with the correct settings

@use 'settings/breakpoints';
@use 'settings/breakpoints';
@use '~include-media' as im with (
  $breakpoints: breakpoints.$breakpoints,
  $media-expressions: breakpoints.$media-expressions,
);

And then in each file where I need it, I just load it like this

@use '~include-media' as im;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant