InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

CSS

    CSS selectors

    • CSS selectors

    CSS properties

    • CSS properties

    CSS cookbooks

    • !important annotation
    • Align div in center horizontally
    • Align div in center vertically
    • Align multiple divs horizontally
    • Align text in center horizontally
    • CSS - drop cap effect
    • CSS - enlarge image on hover
    • CSS - round toggle switch using checkbox and label
    • CSS automatic table row numbering
    • CSS circle and oval
    • CSS clearfix - clear float automatically using ::after
    • CSS counters
    • CSS nested counters
    • CSS3 gradients
    • Create CSS triangles
    • First letter capital and bigger
    • How to display text on image using css
    • Install sass on Mac or Linux using ruby gem
    • Place a div in bottom right corner of browser
    • Test site css, javascript, html in old IEs
    • csslint
    • inherit value
    • initial value
    • inline-block and baseline alignment
    • margin collapsing
    • node-sass quick start tutorial on Linux and Mac
    • unset value
    • web typography
     
    • Home
    • > Tutorials
    • > CSS

    node-sass quick start tutorial on Linux and Mac

    | Last updated on Sep 27, 2016

    Sass (Syntactically Awesome Stylesheets) is a style sheet language which brings programming features like variables, etc. to css. It makes maintaining and modifications in css easier. The new main syntax of sass (version 3) is called scss (sassy css).

    Here is quick start guide of installing and using node-sass on Linux and Mac. Note that node-sass uses LibSass, the C version of Sass.

    1. First install node and npm using the following steps.
      • How to install node (node.js) on Mac
      • How to install node.js on Ubuntu Linux
    2. Install node-sass package using npm install. For Ubuntu, you will have to use sudo.

      $ sudo npm install node-sass  # Ubuntu
      $ npm install node-sass  # Mac
      

      To install globally

      $ sudo npm install -g node-sass  # Ubuntu
      $ npm install -g node-sass  # Mac
      
    3. Check node-sass version

      $ node-sass --version
      node-sass	3.4.2	(Wrapper)	[JavaScript]
      libsass  	3.3.2	(Sass Compiler)	[C/C++]
      
    4. Create a test scss file (test.scss) containing a variable.
      $bgcolor: red;
      div {
        background-color: $bgcolor;
      }
      h2 {
        background-color: $bgcolor;
      }

    5. Compile test.scss to test.css

      $ node-sass test.scss test.css
      Rendering Complete, saving .css file...
      Wrote CSS to /Users/user1/tmp3/test.css
      $ cat test.css
      div {
        background-color: red; }
      
      h2 {
        background-color: red; }
      

      Note that the variable has been replaced by it value.

    Suggested posts:

    1. document querySelector examples
    2. Use netcat (nc) to listen on tcp or udp port
    3. Mac brew – how to find latest available package without installing
    4. How to prevent ssh session freezing due to timeout
    5. bower – installation and quick start guide
    6. jQuery – find total number of DOM elements
    7. HTML import
    8. LXC (Linux Containers) – quick start tutorial on Ubuntu
    Share this article: share on facebook share on linkedin tweet this submit to reddit
    Posted in Tutorials | Tagged CSS, CSS cookbook, Linux, Linux/Unix Command Line, Mac, Tutorials
    • Browse content
    • Article Topics
    • Article archives
    • Contact Us
    Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

    Copyright © 2025 InfoHeap.

    Powered by WordPress