Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Dec 2016
    Posts
    17
    Member #
    55967
    Liked
    1 times

    Why use SASS/ LESS?

    Why use SASS/ LESS?
    I get the idea, to make CSS smaller, etc. But do I really need to make CSS use functions, and variables? And if I'm writing large SASSS/LESS files, why not just write a CSS file?
    I believe I've got the idea, but I want some other opinions/ clarifications. Thanks

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    I personally like variables, mixins and nesting.

    Variables are nice for the same reason they are in other languages. You change a value in one place, and it permeates through the whole body of code.

    Mixins, which are kind of like functions, allow me to write one line of CSS that outputs an entire set of properties. One that I use pretty regularly is a clearfix mixin. When you float elements, as you probably know, it causes their container to collapse. To correct that, people use a clearfix. A lot of people use a clearfix element, but I use the after pseudo-element. It requires more lines of CSS, but keeps style separate from structure, as it's meant to be.
    So, I have this mixin defined:
    Code:
    @mixin clearfix{
    
      content: '';
      display: block;
      height: 0;
      width: 0;
      clear: both;
    
    }
    Then, in the rest of my SCSS:
    Code:
    .container{
      /* some css */
      &::after{
        @include clearfix;
      }
      .innerElements{
        float: left;
      }
    }
    Finally, nesting. I really don't know how better to describe it, except that nesting just feels like how CSS should have been designed from the beginning.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Junior Member
    Join Date
    Jun 2017
    Posts
    4
    Member #
    56774
    Liked
    1 times
    Hello,

    I wrote an article about advantages and usage of LESS. You can check it, maybe it'll be useful for you:
    https://www.kurzor.co.uk/blog/25-less-advanced-en


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:52 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com