I’m somewhat confused between Scss and Css and how codepen works…
I’ve tried copying and pasting multiple scripts from codpen with almost 0 success. I’ve looked through the code to see if there are dependencies missing and from what I can tell, no, but I’m sure there are.
Does css and scss work in conjunction or is it one OR the other?
This is what I’m doing:
Create: masonry.html ->copy and paste from codepen
Create: masonry.css ->copy and paste from codepen & link in html
There doesn’t seem to be any js, It’s the scss ‘hidden’ that is confusing me. I can download or view in “view” and create a scss file from the text but when I create link to the scss file it doesn’t work.
hey @gregstah yes that codepen is using sass, if you want to use sass outside of the codepen you will need a sass compiler, if your using vs code you can use something like Live Sass Compiler add on, or you can install sass on your machine https://sass-lang.com/install
you can use css in a scss file like normal but you cant use sass in a css file, the way it works is when you use sass in a scss file the browser will not be able to read it, so this is where the compilar comes in and compiles the scss file into css code so the browser can read it.
in codepen there is the button “view compiled css” when you are using a compiler and that css than you can use anywhere without a compiler being needed
SCSS is only a preprocessor as everyone already said. Unfortunately you cannot use .scss or .sass directly into an html file. You have to pre-compile it. As @ILM said, there is a feature in codepen to view the compiled version of the css.
Just for some more specific explanation on how it works.
As you can see here. The styles.css.map is just the compiling map. It’s like the direction for the compiler to compile from .scss to .css. As you can also see that I linked the styles.css instead of the styles.scss