Hi, I checked your already asked questions but they all seem to be about SASS vs LESS or problems using them. My Problem is - what are they?
I am used to using CSS but really do not understand where SASS and LESS fit into the picture. I keep seeing articles about pre-compilers and I understand Bootstrap uses SASS or LESS but I only see CSS and JS files but then I see some .map files that seem to be linked in some way to CSS or SASS or LESS but then I read that .map files are used in JS.
I am totally confused, having just sorted CSS - there are now all these new considerations.
Thanks guys
Can someone please help me to understand how these technologies fit into web design
OK, so if I am using Bootstrap with Bootstrap.min.css - am I using a CSS file, a SASS file or a LESS file, how do I tell. Does SASS or LESS create a CSS file - do they have different extensions, still confused.
Without getting into too much detail Sass/less are pre-processors that can facilitate the building of your css files in certain ways. They allow variables, nested code, loops & conditionals (similar to js) and other functions that you can’t do automatically in css.
At the end of the day they compile into pure CSS as that’s all a browser understands. That’s why they are called a pre processor as you can process all your fancy variables and loops in this pre-process state but once it gets complied it’s just pure css.
Big frameworks and large projects love the flexibility pre-processors can give and although I have worked with them I am not a big fan but can see the advantages in some cases.
It’s good to have knowledge of them if you are working in a team or on a large project and there are plenty of tutorials around that you can take and would be a worthwhile venture even if you decide to stick with plain old css.
The map files (as used in bootstrap) are a way to keep track of where the files originally came from before they were all compiled.
So if I am using Bootstrap CSS files and JS files I do not need the .map files ? Why would I use variables, loops and conditions if I am going to compile into pure CSS, surely I would lose all the loops, variables and conditions ?
Yes that is a normal (but minified) css file as you can see from the .css extension. That is what you would get after you have compiled your LESS/SASS etc.
You can’t just use Sass or Less you have to install a number of applications in order to use them. They won’t work unless the code is interpreted and compiled into normal css. It’s the normal css that is then output (or used) in your browser.
Imagine you had a 100 or more CSS rules for say something like every country flag in the world.
You could use a loop in your preprocessor to output the css in a single function.
e.g.
$images: 100;
@for $i from 1 through $images {
.image-#{$i} {
background: url(image-#{$i}.jpg);
}
}
If you use codepen you can play around with sass/less etc as it has a built in compiler. You set it up using the gear icon in the css panel. You can then view the compiled css using the down arrow in the css panel.
Here’s the example above (there is no html in this example).
Sorry but maybe I am stupid but the last reply tells me it was 6/7 but I cant find 7 my status tells me rkamp made a post but I can only see 6, I cant see theirs. I cant see any more… or next… pr page options - anyone help ? I am obviously missing something !
Sorry it was just a like and I noticed that although the latest post is displayed the Post # / Total posts counter on the right only updates when the post is at the very top of the screen, apologies - thanks