The journey of #100DaysOfCode (@Darine_Tleiss)

100daysofcode - Day13

Hello friends, How it’s going on :smiling_face_with_three_hearts:, wrapping up our 13th day successfully with some amazing content. And a deep dive :diving_mask: into SASS and SCSS.

In yesterday’s post, we defined SCSS and SASS, how they extend the CSS capabilities giving us a lot of features out of box :star_struck::smiling_face_with_three_hearts:, making the front end developers life a smooth :hugs: and productive one :muscle:. We also mentioned the SCSS architecture :construction_worker_woman:, with a gentle intro about the thinking and building phase. And now it’s time to resume :play_or_pause_button: our process and talk more about the 3 and the most important phase. The (Think Build Architect) 3rd parameter.

YEAH, You guessed it !!. The Architect phase :heart_eyes::blush::sunglasses:

  Architect ?: In this phase we should create a logical architecture to organize our CSS files
 and folders.
  And here we follows the famous 7-1 pattern :thinking::star_struck:

  • 7-1 pattern ?: A famous :sunglasses: and well adopted structure that serves as a solid base for large :partying_face:and production projects. In this :seven:/:one: arch we have 7 different folders for partial SCSS files and a single :smiling_face_with_tear:file that sits at the root, we usually call it the main file, where all files are imported to be compiled into a compatible CSS stylesheet :white_check_mark:

How does the seven/one pattern organize the folders and files in SCSS ? :thinking:

  Starting with folders, we will explore each one of them in deep details, starting with:

  1. Base: the folder that hold the boilerplate :curry: code of the project, including all standard styles, like the typographic rules, which they are used :repeat: commonly throughout the project :sunglasses:
    Example:

            	base/
                      _animations.scss
          			  _typography.scss
          		      _ base.scss(contains the html and body components)
    
  2. Components: the folder that hold the style of the sliders, buttons, and all similar :tada: components like the reusable widgets in React JS :grinning::nerd_face:
    Example:

    		  components/
    				_button.scss
    				_form.scss
                    _popup.scss
    
  3. Layout: the folder that contains the styles files that control the project layout :artist:, like the styles of the navigation bar, the header, the footer :end::no_mouth:
    Example:

    	  layout/
    		_footer.scss
    		_navigation.scss
    		_header.scss
    
  4. Pages: the folder that contains the specific style of an individual :man_technologist::smiling_face_with_three_hearts: page, like the home page style. Which is not :x: required in other pages and at the same time does not 🆇 require any style from other pages.
    Example:

        	 pages/
                _home.scss
    
  5. Themes: a folder that contains the files of specific themes, and it’s not used in every :repeat: project out there :earth_africa:, as it only required if we have some sections the contain alternate schemes :art:
    Example:

    	   themes/
    		    _theme.scss
    		    _admin.scss
    
  6. Abstracts: the folder that contains the helper :rescue_worker_helmet: files, mixins functions, SASS tools :gear: and any other config file :wrench:, and this files are just helpers which don’t output when they get compiled :roll_eyes:
    Example:

           abstracts/
    	       _functions.scs
    	       _mixins.scss
    	       _variables.scss
    
  7. Vendors: the folder that contains all third :3rd_place_medal: party code and all external libraries​:books:, like bootstrap, jQuery, tailwind …
    Example:

    	   vendors/
    	     	_bootstrap.scss 
    	    	_jquery-ui.scss
    

  So yeah, now we explored :world_map: our :seven: folders successfully :white_check_mark:, so let’s move on and explore the single file that exists in the amazing architecture. :slightly_smiling_face:

  1. main.scss: the file that only :sob: contains the required imports from all :muscle: other files.:innocent:
    Example:

        
            @import "abstracts/functions";
            @import "abstracts/mixins";
            @import "abstracts/variables";  
               
            @import "base/animations";    
            @import "base/base";  
            @import "base/typography";    
            @import "base/utilities";    
               
            @import "components/bg-video" ;  
            @import "components/button";  
            @import "components/card";
            @import "components/composition";
            @import "components/feature-box";
            @import "components/form";
            @import "components/popup";
            @import "components/story";
                   
            @import "layout/footer";
            @import "layout/grid";    
            @import "layout/header";
            @import "layout/navigation";
             
            @import "pages/home";
    

And now, we have reached the end of our post. I hope you enjoyed :face_with_hand_over_mouth: reading it and benefited from it. Stay tuned for my ⎘ next posts where we will learn together :muscle: how we can install :computer: SASS and SCSS, via the node package manager and start exploring it in an interactive way :tada::smiling_face_with_three_hearts::star_struck:

5 Likes