Customization

Take advantage of the Front's past, current and future updates, by learning how to create your own content without changing the core styles of Front.

How to include a typeface?

Add or change Front typography with the following instructions.

With SASS

  1. Use the $font-family-base attribute as our typographic base applied to the <body> in _variables.scss file to change the current font family variable with yours.
                    
                      $font-family-base: "Poppins", Helvetica, Arial, sans-serif !default;
                    
                  
  2. Add your font stylesheet into the <head> before all other stylesheets. Like:
                    
                      <!-- CSS Global Compulsory -->
                      <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Poppins:300,400,500,600,700">
                    
                  

With CSS

  1. Simply replace the font family font-family from <body> in theme.css tag with yours.
                    
                      body {
                        font-family: "Poppins", Helvetica, Arial, sans-serif;
                      }
                    
                  
  2. Add your font stylesheet into the <head> before all other stylesheets. Like:
                    
                      <!-- CSS Global Compulsory -->
                      <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Poppins:300,400,500,600,700">
                    
                  

SASS

Utilize our source SASS files to take advantage of variables, mixins, and more.

Whenever possible, avoid modifying Front's core files. For SASS, that means creating your own stylesheet that imports Bootstrap so you can modify and extend it.

Customizing SASS

To avoid file loss, overrides of your custom styles or any other conflicts during the upgrade process, create or modify your styles with these 4 files assets/scss/custom/custom/:

  • _user-variables.scss - Variables file for customizing or overriding Bootstrap core and Front elements/components that have been tied to variables.
  • _user.scss - Create a new style in here.

Variable defaults

Every SASS variable in Front includes the !default flag allowing you to override the variable's default value in your own SASS without modifying either Bootstrap or Front's source code. Copy and paste variables as needed, modify their values, and remove the !default flag. If a variable has already been assigned, then it won't be re-assigned by the default values in Front.

You will find the complete list of Front's variables in assets/include/scss/_variables.scss.

Variable overrides within the same SASS file can come before or after the default variables. However, when overriding across SASS files, your overrides must come before you import Front's SASS files.

Here's an example that changes the color of the template in the scss/custom/_custom-variables.scss file when importing and compiling Front via npm:

            
              // Your variable overrides
              $blue: #377dff; // Primary color
            
          

Maps and loops

Bootstrap 4 includes a handful of SASS maps, key value pairs that make it easier to generate families of related CSS. We use SASS maps for our colors, grid breakpoints, and more. Just like SASS variables, all SASS maps include the !default flag and can be overridden and extended.

Some of our SASS maps are merged into empty ones by default. This is done to allow easy expansion of a given SASS map, but comes at the cost of making removing items from a map slightly more difficult.

Modify map

To modify an existing color in our $theme-colors map, add the following to your custom SASS file:

            
              $theme-colors: (
                "primary": #377dff,
                "danger": #de4437
              );
            
          

Add to map

To add a new color to $theme-colors, add the new key and value:

            
              $theme-colors: (
                "custom-color": #000
              );
            
          

SASS options

Customize Front with our built-in custom variables file and easily toggle global CSS preferences with $enable-* SASS variables. Override a variable's value and recompile with npm run test as needed.

You can find and customize these variables for key global options in Front's scss/_variables.scss file.

Variable Values Description
$spacer 1rem (default), or any value > 0 Specifies the default spacer value to programmatically generate our spacer utilities.
$content-space 1rem (default), or any value > 0 Specifies the default spacer value to programmatically generate our spacer utilities.
$enable-rounded true (default) or false Enables predefined border-radius styles on various components.
$enable-shadows true or false (default) Enables predefined box-shadow styles on various components.
$enable-accessibility true or false (default) Enables predefined accessibility styles on various components.

Color

Many of Front's various 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 rulesets.

All colors

All colors available in Front, are available as SASS variables and a SASS map in scss/_variables.scss file.

Blue
Yellow
Teal
Blue darker
Yellow darker
Teal lighter
Blue lighter
Yellow lighter
Indigo
Red
Cyan
Dark
Red lighter
Cyan lighter
White
Facebook
Google
Twitter
Instagram
Github

Here's how you can use these in your SASS:

            
              .alpha {
                color: $primary;
              }

              // From the SASS map with Bootstrap `color()` function {
              .beta {
                color: color("purple");
              }
            
          

Color utility classes are also available for setting color and background-color.

Theme colors

We use a subset of all Bootstrap colors to create a smaller color palette for generating color schemes, also available as SASS variables and a SASS map in Front's scss/_variables.scss file.

Primary
Secondary
Success
Danger
Warning
Info
Dark
Indigo
Light
White

Grays

An expansive set of gray variables and a SASS map in scss/_variables.scss for consistent shades of gray across your project.

200
300
400
500
600
700
900

SASS Components

Many of Bootstrap's components and utilities are built with @each loops that iterate over a SASS map. This is especially helpful for generating variants of a component by $theme-colors and creating responsive variants for each breakpoint. As you customize these SASS maps and recompile, you'll automatically see your changes reflected in these loops.

Modifiers

Many of Bootstrap and Front's components are built with a base-modifier class approach. This means the bulk of the styling is contained to a base class (e.g., .btn) while style variations are confined to modifier classes (e.g., .btn-danger). These modifier classes are built from the $theme-colors map to make customizing the number and name of our modifier classes.

Here are two examples of how we loop over the $theme-colors map to generate modifiers to the .alert component and all our .bg-* background utilities.

            
              // Generate alert modifier classes
              @each $color, $value in $theme-colors {
                .alert-#{$color} {
                  @include alert-variant(theme-color-level($color, -10), theme-color-level($color, -9), theme-color-level($color, 6));
                }
              }

              // Generate `.bg-*` color utilities
              @each $color, $value in $theme-colors {
                @include bg-variant('.bg-#{$color}', $value);
              }
            
          

Customizing JS

To avoid file loss, overrides of your custom styles or any other conflicts during the upgrade process, create or modify your styles with assets/js/theme-custom.js file.