{"id":2961,"date":"2016-05-31T08:01:10","date_gmt":"2016-05-31T08:01:10","guid":{"rendered":"https:\/\/www.cmarix.com\/blog\/?p=2961"},"modified":"2024-06-24T06:23:09","modified_gmt":"2024-06-24T06:23:09","slug":"how-to-install-sass","status":"publish","type":"post","link":"https:\/\/www.cmarix.com\/blog\/how-to-install-sass\/","title":{"rendered":"How to Install SASS"},"content":{"rendered":"<p>CSS is experiencing a revolution as it tries to keep in pace with the advancements into virtually every aspect of the technology ecosystem. But even while it&#8217;s getting support with some amazing new properties, it still has its downfalls such as it gets difficult to manage CSS in large projects. The need to take care of this issue has brought the idea of the CSS pre-processors like SASS which stands for Syntactically Awesome Style Sheets.<\/p>\n<p><strong><a href=\"https:\/\/www.cmarix.com\/blog\/what-is-sass-syntactically-awesome-style-sheets\/\">SASS<\/a><\/strong> is the CSS pre-processor language that expands CSS capabilities and makes the process of creating and maintaining CSS much easier, organized and cleaner. It offers superpowers to the plain CSS and endeavors to meet the web design needs of today by providing options like variables revelation, reusable style blocks known as &#8220;mixins&#8221;, inheritance, nesting rules, and numerous other elements as well. The end result generated after compiling is the same as writing the code out manually with regular CSS.<\/p>\n<p>It&#8217;s easy, to begin with, SASS since it is perfect with all forms of CSS. This implies that you can still write regular CSS in a SASS file, which in addition will give you an option of using all the benefits of SASS. The main distinction is that the working file extension changes from .css to .scss, which needs to be compiled. The compiled SASS document is the CSS file which has to be incorporated into your HTML.<\/p>\n<h2>Benefits of SASS<\/h2>\n<h4>Few HTTP requests<\/h4>\n<p>In CSS, separate CSS documents are utilized based on the content. An issue with this methodology is that it includes HTTP requests on the website for each file being made which results in the decreased loading time as well as the speed of website. But, with the presentation of SASS, the style sheets are broken into numerous files which are later aggregated into one file which <a href=\"https:\/\/github.com\/sass\/sass\/issues\/193\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">reduces the HTTP request<\/a> as compared with the standard.<\/p>\n<h4>Reduce Duplication<\/h4>\n<p>SASS variables roll out less demanding code by decreasing duplication. The variables additionally permit you to assign nam<em>es<\/em> to exceptional property estimations like colors, which help you understand the expectation behind a given style.<\/p>\n<h4>Reusable Code<\/h4>\n<p>One of the best advantages of SASS is the ability to reuse the code. With @mixin, @extend, and @include, you can make repeatable codes that make the life of the designers less demanding.<\/p>\n<h4>A code Easier to Follow<\/h4>\n<p>With the help of the nesting mechanism, you can compose SCSS code that is both less repetitive and simpler to refer. Saving your time &amp; effort reviewing the code in case it doesn&#8217;t work in the first attempt.<\/p>\n<h2>Installation of SASS using Grunt<\/h2>\n<p>Before installation let us tell you what is <em>Grunt<\/em>?<\/p>\n<p>Grunt is a task runner command-line tool for JavaScript project. It helps to perform repetitive task, for instance, tasks like Minification, Compilation, Unit testing, Linting and more.<\/p>\n<h3>Following are the steps to install GruntJS on your system:<\/h3>\n<ul>\n<li>Install <strong>node js<\/strong><strong> (<\/strong><strong>http:\/\/nodejs.org\/)<\/strong> and follow on-screen wizard steps. (as per us 32\/64 bit)<\/li>\n<li>Set %path% ( environmentalvariable ) to &#8220;C:\\Windows&#8221;<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-2963 size-full\" src=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/environment-variables.png\" alt=\"install GruntJS on your system\" width=\"650\" height=\"668\" srcset=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/environment-variables.png 650w, https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/environment-variables-292x300.png 292w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<ul>\n<li>Open the command prompt as administrator and run below command to install grunt<\/li>\n<\/ul>\n<p><strong> npm install grunt-cli -g<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-2964 size-full\" src=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/install-grunt-globally.png\" alt=\"install grunt globally\" width=\"655\" height=\"380\" srcset=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/install-grunt-globally.png 655w, https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/install-grunt-globally-300x174.png 300w\" sizes=\"(max-width: 655px) 100vw, 655px\" \/><\/p>\n<ul>\n<li>Create <strong>json<\/strong> file using &#8220;<strong>npm init<\/strong>&#8221; in the project directory<\/li>\n<\/ul>\n<p><strong><img decoding=\"async\" class=\"aligncenter wp-image-2965 size-full\" src=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/package-json.png\" alt=\"Create json file using &quot;npm init&quot;\" width=\"536\" height=\"395\" srcset=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/package-json.png 536w, https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/package-json-300x221.png 300w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/strong><\/p>\n<ul>\n<li>Run the command for Grunt installation<\/li>\n<\/ul>\n<p><strong>npm install grunt &#8211;save -dev<\/strong><\/p>\n<ul>\n<li>Install <strong>Grunt-SASS<\/strong> package run this command<\/li>\n<\/ul>\n<p><strong> npm install grunt-SASS &#8211;save-dev<\/strong><\/p>\n<ul>\n<li>Setup a gruntfile and load required <strong>npm tasks<\/strong> as well as register your required task.<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-2966 size-full\" src=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/gruntfile-js.png\" alt=\"Setup a gruntfile and load required npm tasks\" width=\"446\" height=\"415\" srcset=\"https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/gruntfile-js.png 446w, https:\/\/www.cmarix.com\/blog\/wp-content\/uploads\/2016\/05\/gruntfile-js-300x279.png 300w\" sizes=\"(max-width: 446px) 100vw, 446px\" \/><\/p>\n<ul>\n<li>Run your registered command line <strong>(&#8220;grunt buildcss&#8221;)<\/strong> in your project directory to compile SCSS file to CSS.<\/li>\n<\/ul>\n<p>Bringing us to a conclusion that utilizing SASS rather than CSS will let you protect yourself from the quick and gritty mechanics of CSS while keeping you near the language structure and semantics of CSS. SASS is a significant extension that can enhance your CSS to make it cleaner, very much organized and simple to create and maintain<em>. <\/em>It makes developers&#8217; lives way less demanding, and permits them to cut down the time they spend on <a href=\"https:\/\/www.cmarix.com\/front-end-development.html\">front-end development<\/a> enabling fast prototyping. We do anticipate the CSS core to get the core updated in the future to accommodate advanced features, however, that is a long way from now, henceforth the development using SASS systems will be popular.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CSS is experiencing a revolution as it tries to keep in pace [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":2962,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[15],"tags":[],"class_list":["post-2961","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-design"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/posts\/2961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/comments?post=2961"}],"version-history":[{"count":9,"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/posts\/2961\/revisions"}],"predecessor-version":[{"id":38210,"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/posts\/2961\/revisions\/38210"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/media\/2962"}],"wp:attachment":[{"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/media?parent=2961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/categories?post=2961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cmarix.com\/blog\/wp-json\/wp\/v2\/tags?post=2961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}