{"id":1573,"date":"2019-08-29T20:40:50","date_gmt":"2019-08-29T15:10:50","guid":{"rendered":"https:\/\/www.xhtmlchop.com\/blog?p=1573"},"modified":"2019-08-30T15:06:58","modified_gmt":"2019-08-30T09:36:58","slug":"sass-a-css-preprocessor","status":"publish","type":"post","link":"https:\/\/www.xhtmlchop.com\/blog\/sass-a-css-preprocessor\/","title":{"rendered":"SASS: A CSS preprocessor"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1579\" src=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-development-service.jpg\" alt=\"\" width=\"718\" height=\"478\" srcset=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-development-service.jpg 718w, https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-development-service-300x200.jpg 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>If you are looking for ways to use SASS with Bootstrap read on, you will find below a simple guide to accomplish that.<\/p>\n<p>SASS and LESS are tools that greatly enhance CSS development and are extensively being used by development agencies and corporates for dynamic UI integrations.<\/p>\n<p>SASS, a CSS preprocessor brings real language features to CSS such as variables and mixins (functions) which result in clean, extensible and reusable CSS codes.<\/p>\n<p>Bootstrap4 being a popular open-source framework, provides complete pre-built SASS preprocessor. It allows developers and users to easily build and customize an UI.<\/p>\n<p><strong>SASS with Bootstrap!!!<\/strong><\/p>\n<p>Bootstrap utilizes source SASS files to take advantage of variables, maps and mixins besides others.<\/p>\n<p>We don&#8217;t need to edit\/modify Bootstrap\u2019s core files. For SASS, modifying core file means creating your own stylesheet that imports Bootstrap so you can modify and extend it. We recommend using a package manager like npm, which provides file structure that looks like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1574\" src=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-modification.jpg\" alt=\"\" width=\"718\" height=\"217\" srcset=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-modification.jpg 718w, https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-modification-300x91.jpg 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>If downloaded from bootstrap source files and not using a package manager, we need to manually setup the structure, keeping Bootstrap\u2019s source files separate as below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1575\" src=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-structure.jpg\" alt=\"\" width=\"718\" height=\"195\" srcset=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-structure.jpg 718w, https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-sass-structure-300x81.jpg 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p><strong>Importing SASS<\/strong><\/p>\n<p>Custom.scss, will be the file where we will import Bootstrap\u2019s source SASS files. We can accomplish this in two ways:<\/p>\n<p>1. Using @import for the entire Bootstrap<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1576\" src=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-import-for-the-entire-bootstrap-sass.jpg\" alt=\"\" width=\"718\" height=\"149\" srcset=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-import-for-the-entire-bootstrap-sass.jpg 718w, https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-import-for-the-entire-bootstrap-sass-300x62.jpg 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>OR<\/p>\n<p>2. Using @import to pick the parts you need from Bootstrap<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1577\" src=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-import-to-pick-the-parts-from-bootstrap-sass.jpg\" alt=\"\" width=\"718\" height=\"389\" srcset=\"https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-import-to-pick-the-parts-from-bootstrap-sass.jpg 718w, https:\/\/www.xhtmlchop.com\/blog\/wp-content\/uploads\/2019\/08\/xhtmlchop-import-to-pick-the-parts-from-bootstrap-sass-300x163.jpg 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>With this setup, we can begin to modify any SASS variable or map in the custom.scss.<\/p>\n<p><strong>FEATURES of SASS with BOOTSTRAP:<\/strong><\/p>\n<ul>\n<li><strong>Variable defaults<\/strong><br \/>\nWe include the !default flag allowing you to override the default value for the without modifying the source code of the Bootstrap.<\/li>\n<li><strong>Maps and loops<\/strong><br \/>\nWe include a handful SASS maps, key value pairs that make it easier to generate families of related CSS. SASS maps are useful for colors, grid breakpoints and more.<\/li>\n<li><strong>Functions<\/strong><br \/>\nBootstrap utilizes several SASS functions, but only a subset of functions are applicable to general theming.<\/li>\n<li><strong>Colors<\/strong><br \/>\nVarious components and utilities are built through a series of colors defined in a SASS map. This map can be looped over in SASS to quickly generate a series of rule sets. Within variables.scss, you will find our color variables and the SASS map.<\/li>\n<li><strong>SASS options<\/strong><br \/>\nCustomize Bootstrap 4 with our built-in custom variables file and easily toggle global CSS preferences with new $enable-* SASS variables. Override a variable\u2019s value and recompile with npm run test as needed.<\/li>\n<li><strong>Components<\/strong><br \/>\nComponents and utilities are built with @each loops that iterate over a SASS map. This is especially helpful for generating variants of a component by our $theme-colors and creating responsive variants for each breakpoint. As you customize these SASS maps and recompile, you will automatically see your changes reflected in these loops.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you are looking for ways to use SASS with Bootstrap read on, you will find below a simple guide to accomplish that. SASS and LESS are tools that greatly enhance CSS development and are extensively being used by development agencies and corporates for dynamic UI integrations. SASS, a CSS preprocessor brings real language features [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[95],"tags":[],"class_list":["post-1573","post","type-post","status-publish","format-standard","hentry","category-sass"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/posts\/1573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/comments?post=1573"}],"version-history":[{"count":0,"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/posts\/1573\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/media?parent=1573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/categories?post=1573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xhtmlchop.com\/blog\/wp-json\/wp\/v2\/tags?post=1573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}