Customization
You can take advantage of the Nova's past, current and future updates, by learning how to create your own content without changing the core styles of Nova.
With CSS:
-
Simply replace the font family
font-family
from<body>
intheme.css
tag with yours. -
Add your font stylesheet into the
<head>
before all other stylesheets. Like:
With SASS:
-
Use the
$font-family-base
attribute as our typographic base applied to the<body>
in_user-variables.scss
file to change the current font family variable with yours. -
If you are using fonts from Google Fonts, just add your font stylesheet into the
<head>
before all other stylesheets:
SASS
Utilize our source SASS files to take advantage of variables, mixins, and more.
Whenever possible, avoid modifying Nova'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, you should create or modify your style with these 2 files [assets/scss/]
:
_user-variables.scss
- Variables file for customizing or overriding Bootstrap core and Nova elements/components that have been tied to variables._user.scss
- Create a new style in here.
Note
Custom files along with Bootstrap core CSS files will be generated into the theme.css
file.
Variable defaults
Every SASS variable in Nova includes the !default
flag allowing you to override the variable's default value in your own SASS without modifying either Bootstrap or Nova'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 Nova.
You will find the complete list of Nova's variables in assets/include/scss/nova/_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 Nova's SASS files.
Here's an example that changes the color
of the template in the scss/_user-variables.scss
file when importing and compiling Nova via npm:
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:
SASS options
Customize Nova with our built-in custom variables file and easily toggle global CSS preferences with $enable-*
SASS variables. Override a variable's value and recompile as needed.
You can find and customize these variables for key global options in Nova's scss/_theme-variables.scss
file.
Variable | Values | Description |
---|---|---|
$spacer |
1rem (default), or any value > 0 |
Specifies the default spacer value to programmatically generate additional padding and margins. |
$enable-rounded |
true (default) or false |
Enables predefined border-radius styles on various components. |
$enable-accessibility |
true or false (default) |
Enables predefined accessibility styles on various components. |
$enable-print-styles |
true or false (default) |
Enables styles for optimizing printing. |
Color
Many of Nova'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 Nova, are available as SASS variables and a SASS map in scss/_theme-variables.scss
file. Below is how you can use these in your SASS:
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 Nova's scss/nova/_variables.scss
file.
Grays
An expansive set of gray variables and a SASS map in scss/nova/_variables.scss
for consistent shades of gray across your project.
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 Nova'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.