Code Monkey home page Code Monkey logo

learn_sass_scss's Introduction

SASS

SASS is abbreviation for Syntactically Awesome Style Sheets. It is CSS preprocessor. Basically, it is much more to CSS i.e. CSS with superpowers.

SASS --- for CSS

SCSS is same but we called it that for CSS3. Extension to filea is ".scss"

Why SASS?

As for beginners point of view, it gives removes browser compatibility issues. If we add a property to scss file, its browser compatibility prefix will be added automatically to css file.

Also it time saving because, repeated code is eliminated wih using SASS, i.e., we gie a name to line of codes and include it whereever it is needed.

SASS fetures / superpowers

  1. Operators - can use operators eg. font-size: 3rem + 1.5rem;

  2. Variables - we can use variables also to give values to property eg. $font_s: 1.5rem; -----> font-size: 3rem + $font_s;

  3. Nesting - code section with a code section.

  4. Mixin and include - properties which are repeatedly used can be for mixin, those properties can be used later whenever, and wherever needed by including its name.

  5. Partials and import - you can make seperate file for each css section, eg. variables in different file, mixin codes in different file.

Note: you can use scss/main.scss for reference. I have added comments to help you getting what is really happening. You dont have to make mapping file and css file. It will be automatically be created.

Using SASS in Visual Studio

You have to install a plugin "Live SASS Compiler", after it gets installed you will see "Watch SASS" button at status bar.

Make index.html file.

Make scss/main.scss file.

Write your code in index.html (you can use my sample code)

Write proprties in main.scss (refer to my main. scss)

Press "Watch SASS", you have to press it only once, new code will be compiled automatically.

This will make mapping file and css file. You can see css file, you will see what I was talking in why SASS.

Don't forget to add reference of css file (not scss file) to index.html to reflect css properties.

Enjoy!!

learn_sass_scss's People

Contributors

princemayur007 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.