How to add Custom CSS/SCSS in Gantry 5 Theme
If you need to override existing styles, add extra codes or style files for a template/theme/particle- we recommend to follow instructions below. By following this way, your overrides and custom styles won't affect with the template/theme update later.
Create a custom.scss file
- On Joomla!, create directories and files by following
ROOT/templates/DEFAULT_TEMPLATE/custom/scss/custom.scss
- On WordPress, create directories and files by following
ROOT/wp-content/themes/DEFAULT_THEME/custom/scss/custom.scss
- On Grav CMS, create directories and files by following
ROOT/user/data/gantry5/themes/DEFAULT_THEME/scss/custom.scss
using an FTP client like FileZilla or using your cPanel File manager.
- Open
custom.scss
file you just created
- Add
@import "dependencies";
custom.scss
file and add any other codes under this line.
- From now on, you can add all your customization codes on the custom.scss file.
Adding a new style file
If you need to add a new style file-
- Go to custom
scss
folder you just created above and create or upload your file with the format_filename.scss
- Open
custom.scss
- Now add
// My new file _filename.scss @import "
filename
";
- Make sure
@import "dependencies";
line stays on top of everything.
Clear Cache and Recompile CSS
If you site is in Production mode or if you can't see changes for your custom codes-
- Go to Gantry Admin
- Click on Styles tab
- Click on Extras > Clear Cache from top right corner.
- After successfully clearing cache, click on Recompile CSS button.