scss help I need help understanding something with functions
I have 4 files. all partials and I do this in my
how do you make everything thing work for the button
78 Replies
as you can see there are different files just // to tell you them they are in folders as well
https://sass-lang.com/documentation/at-rules/use/
⚠️ Heads up! A stylesheet’s @use rules must come before any rules other than @forward, including style rules. However, you can declare variables before @use rules to use when configuring modules.
I am confused at what this means
you have to move all those
@use
to the top
no exceptions
all of themthe at use is in the main file my mistake
oh
// main or styles.scss
@use './abstracts/index' as *;
@use './components/index' as *;
@use './layout/index' as *;
@use './base/index' as *;
that what it suppose to say i messed up by not -addint the comment
ah, i see your mistake
you are trying to use
@use
as an @import
by the way this is chatgpt's mistake I was trying to learn this and only a few of this works
well you not suppose to use @import anymore i thought
yeah, you are asking an hallucinating chunk of math to output something that it has limited training data for
despite the shitty decision made by the project, you can use it until version 3.0
you must be an expert because I don't understand what that meant lol
it's still in version 1.x
im saying that chatgpt is bad at stuff it doesnt have in it's data
if it didnt steal, it wont know about it
yeah I asked for the most modern version of scss so I can learn a little more but it seems I might not need something else lol
I might need something else
honestly, for this, i would stick with
@import
LOL I thought it would be deprecated or something and wouldn't work properly
you can use
@use
, but it is not a replacement for @import
I thought it was when you use @forward in an index file
yes, it will be removed in version 3, but they are still in 1.28 or something
I learn to much and forgot most of it lol so I tried to just do the @use bs lol
just give it a good ol' try and you will see how much easier it will be
use
@import
for the styles
you should use @use
for functions and stuff you want to use in some olaces
placesso what do I do
no, delete the
@use
no I ma just wondering if I use the
@import like for the whole folder or the index
if you use
@import
, you cant use as *
it dependsso just
@import 'folder'
im on here because I got tired of cussing out chatgpt lmaoyou can do this:
and then you create a folder called
button
okay I did not know I could do that
and there you have an index.scss file
i have a folder call components with button partial in it
yes and you forward them
that should work, but it is so fucking messy
yes in index so that is what confuses me
this is my over view
the index.scss file is used when it exists in the folder
that sounds sensible to me
yes I understand that. My confusion was trying to use the function on the stuff and use the most up to day version of sass but it seems like the world is behind lol
honestly, the
@use
only causea confusion and makes things harder
causes
because you arent importing: you are creating a local set of functions and variables
and if you want to use something from another file, you have to @use
that file, again and again and again and againI guess I am going to have to look at another video to truly understand shit . the
@use
is suppose to be like import but you can do things like colors as c; folder as * so I don't know so confused how chatgpt steals all this shit and then confuses itself lolfor example, if you want the breakpoints, you need to
@use '../abstracts';
inside every single fileoh am I suppose to put that @use in every file that might use it even if it indirect?
EVERY SINGLE FILE
BUT
only the files that need it
I feell that lol
if you dont need the layout stuff in a file, dont
@use layout
in that file
but you will be typing @use
a fuckton
this is one of the many reasons why @use
is nowhere near a replacement for @import
yes I know that
yeah I understand that too with the no replacement. Like why if I use @use in the main file all of them just don't work so like
@use 'folder' ;
inside the style.scss file should work properlybecause it is local
its only for that file
but if I did
@import
it would work?everything else needs to use
@use
for the same file, again
yes, but without the as *
everything you import is global
that means that the variable $breakpoints
exists for all files you @import
I understand why they separated it because some files use the same variable but this makes me almost not want to use it. Like is it even worth putting that shit together like this anymore
as you said,
@import
is deprecated
it wont be removed anytime soonyes but I am saying should I just use css again only and forget sass lol
but, you have to get used to the insanely inferior version, at some point
nah, sass is too good for that
however, you can write all of this very easily with css
pure css
like I have this mixin and don't even know how to use i t
like border radius not working neither is padding but the colors are working lol
I define the padding in my button as well lmao
do I put that in this file too?
or the
as *
and just @include
the mixin
no
I have that in the button scss though so i thought it would work like this
no, you put it in the index file
or wherever you are generating all the cas
css
i have them in the index file as well but was trying to use it like this so I can make sure I use it explicitly
like the main.css file
I have that in there as well like `@use './abstracts' as *;
you can just create a mixin called
style
, then @forward
in the index file with the prefix button
like I am saying the background colors and color work with no problem
and then you have
button-style
in any file that @use
s the index.scss filei had the padding in there too but my default is not working regardless
try adding it into a string interpolation
i see why it doesnt work
im going to push this to git maybe you can see it better that way
wait, i dont
im at work
i cant see much better
if you can prepare an example with codepen or something, i will check later
https://github.com/althepal78/PortFolio
you can't really do that with codepen because they don't separate files
have fun at work
oh, right
try stackblitz
it seems the repo is private
oh it shouldn't be lol
okay maybe now
i can't see the project in the side window so I don't know what im doing on stackblits
i tried opening it on my phone and it was a disaster
lmao
I don't even know how to use that site lmao
its fine, just a mobile vs desktop thing
no I don't know how to use the site itself so I don't know if it is going to work or not
I am just -not going to use mixins because it is confusing to me
you did everything right
that website works once every blue moon, but i don't know an alternative like it
by the way, you can use
@forward "src/list" as list-*;
I am not even going to bother trying to learn that shit right now I am going to use the same layout but work with that later
I also did this shit and it seems to work with all the files just being used like an import
that is in the main.scss
the funny thing is when it watches sass the import for the font is put on top of the css LOl
that's because
@use
is not a replacement for @import
also, i would avoid google fonts, and would try to find an alternative (there's something about it in #discussions or #resources )Yeah Kevin downloads them instead and uses them a different way I don't mind right now
honestly, i don't know how kevin does many things