{"id":2940,"date":"2015-11-20T14:01:37","date_gmt":"2015-11-20T13:01:37","guid":{"rendered":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/"},"modified":"2015-11-20T14:01:37","modified_gmt":"2015-11-20T13:01:37","slug":"sass-lesson-3-variables","status":"publish","type":"post","link":"https:\/\/www.ice-dev.com\/en\/html-css-js-integration\/sass-lesson-3-variables\/","title":{"rendered":"SASS &#8211; Lesson 3 : Variables"},"content":{"rendered":"<p>A variable can hold several types of information: a color code, a calculation, or even a true\/false value (boolean).<\/p>\n<p>To use a variable, you must declare it with the &#8220;$&#8221; sign followed by its name and value: <b>$background: rgba(black, .2)<\/b>;<\/p>\n<p>Once declared, the variable can be called anywhere in the document, even if it is defined in a file imported using @import.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/915b06553153bedb7327.js\"><\/script><\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/efb85df525b83105f36c.js\"><\/script><\/p>\n<p>Generated CSS code :<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/f231fe6816db78fbbb36.js\"><\/script><\/p>\n<p>The use of a variable has no limit; you can call it as many times as you wish. It is also possible to use a variable in a mixin, a function, or loops.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/6ad80ea38055cf0d4372.js\"><\/script><\/p>\n<h2>Use case of a boolean variable in SASS<\/h2>\n<p>In the <a href=\"https:\/\/www.ice-dev.com\/en\/html-css-js-integration\/sass-lesson-2-divide-and-conquer-refactoring\/\">SASS \u2013 Lesson 2<\/a> post, we explained that it&#8217;s possible to organize your CSS in a modular way.<br \/>\nThanks to <a href=\"https:\/\/fr.wikipedia.org\/wiki\/Bool%C3%A9en\" target=\"_blank\" rel=\"noopener\">boolean variables<\/a>, you can activate or deactivate a partial or a portion of SASS code.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/ac80bee78cc3a54c1019.js\"><\/script><\/p>\n<p>With $use-slider set to &#8220;false&#8221;, the code inside the condition will not be compiled.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the main advantages of SASS is the possibility of using variables. Discover some common and really practical uses ! <\/p>\n","protected":false},"author":2,"featured_media":2027,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"kia_subtitle":"","footnotes":""},"categories":[51],"tags":[],"class_list":["post-2940","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html-css-js-integration"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SASS - Lesson 3 : Variables - Ice Development<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SASS - Lesson 3 : Variables - Ice Development\" \/>\n<meta property=\"og:description\" content=\"One of the main advantages of SASS is the possibility of using variables. Discover some common and really practical uses !\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/\" \/>\n<meta property=\"og:site_name\" content=\"Ice Development\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ice.development\" \/>\n<meta property=\"article:published_time\" content=\"2015-11-20T13:01:37+00:00\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Richin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@icedevelopment\" \/>\n<meta name=\"twitter:site\" content=\"@icedevelopment\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Richin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/\"},\"author\":{\"name\":\"St\u00e9phane Richin\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/person\\\/285b738ea5332302231ff7e0db6becfe\"},\"headline\":\"SASS &#8211; Lesson 3 : Variables\",\"datePublished\":\"2015-11-20T13:01:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/\"},\"wordCount\":160,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/variable-sass.png\",\"articleSection\":[\"HTML\\\/CSS\\\/JS integration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/\",\"name\":\"SASS - Lesson 3 : Variables - Ice Development\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/variable-sass.png\",\"datePublished\":\"2015-11-20T13:01:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/variable-sass.png\",\"contentUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/variable-sass.png\",\"width\":248,\"height\":177},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-3-variables\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.ice-dev.com\\\/en\\\/ice-development\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SASS &#8211; Lesson 3 : Variables\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#website\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/\",\"name\":\"Ice Development\",\"description\":\"agence web Lyon\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.ice-dev.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#organization\",\"name\":\"Ice Development\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/apple-touch-2.png\",\"contentUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/apple-touch-2.png\",\"width\":512,\"height\":512,\"caption\":\"Ice Development\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/ice.development\",\"https:\\\/\\\/x.com\\\/icedevelopment\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/ice-development-lyon\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/person\\\/285b738ea5332302231ff7e0db6becfe\",\"name\":\"St\u00e9phane Richin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g\",\"caption\":\"St\u00e9phane Richin\"},\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/en\\\/author\\\/stephane-richin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SASS - Lesson 3 : Variables - Ice Development","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/","og_locale":"en_US","og_type":"article","og_title":"SASS - Lesson 3 : Variables - Ice Development","og_description":"One of the main advantages of SASS is the possibility of using variables. Discover some common and really practical uses !","og_url":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/","og_site_name":"Ice Development","article_publisher":"https:\/\/www.facebook.com\/ice.development","article_published_time":"2015-11-20T13:01:37+00:00","author":"St\u00e9phane Richin","twitter_card":"summary_large_image","twitter_creator":"@icedevelopment","twitter_site":"@icedevelopment","twitter_misc":{"Written by":"St\u00e9phane Richin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#article","isPartOf":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/"},"author":{"name":"St\u00e9phane Richin","@id":"https:\/\/www.ice-dev.com\/#\/schema\/person\/285b738ea5332302231ff7e0db6becfe"},"headline":"SASS &#8211; Lesson 3 : Variables","datePublished":"2015-11-20T13:01:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/"},"wordCount":160,"commentCount":0,"publisher":{"@id":"https:\/\/www.ice-dev.com\/#organization"},"image":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/variable-sass.png","articleSection":["HTML\/CSS\/JS integration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/","url":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/","name":"SASS - Lesson 3 : Variables - Ice Development","isPartOf":{"@id":"https:\/\/www.ice-dev.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#primaryimage"},"image":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/variable-sass.png","datePublished":"2015-11-20T13:01:37+00:00","breadcrumb":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#primaryimage","url":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/variable-sass.png","contentUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/variable-sass.png","width":248,"height":177},{"@type":"BreadcrumbList","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-3-variables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.ice-dev.com\/en\/ice-development\/"},{"@type":"ListItem","position":2,"name":"SASS &#8211; Lesson 3 : Variables"}]},{"@type":"WebSite","@id":"https:\/\/www.ice-dev.com\/#website","url":"https:\/\/www.ice-dev.com\/","name":"Ice Development","description":"agence web Lyon","publisher":{"@id":"https:\/\/www.ice-dev.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.ice-dev.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.ice-dev.com\/#organization","name":"Ice Development","url":"https:\/\/www.ice-dev.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ice-dev.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2023\/06\/apple-touch-2.png","contentUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2023\/06\/apple-touch-2.png","width":512,"height":512,"caption":"Ice Development"},"image":{"@id":"https:\/\/www.ice-dev.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ice.development","https:\/\/x.com\/icedevelopment","https:\/\/www.linkedin.com\/company\/ice-development-lyon\/"]},{"@type":"Person","@id":"https:\/\/www.ice-dev.com\/#\/schema\/person\/285b738ea5332302231ff7e0db6becfe","name":"St\u00e9phane Richin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g","caption":"St\u00e9phane Richin"},"url":"https:\/\/www.ice-dev.com\/en\/author\/stephane-richin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/posts\/2940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/comments?post=2940"}],"version-history":[{"count":0,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/posts\/2940\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/media\/2027"}],"wp:attachment":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/media?parent=2940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/categories?post=2940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/tags?post=2940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}