SCSS
If you didn’t recognise the @import
command above as CSS, that’s because onCourse uses a variation of CSS called SCSS (also known as SASS). This extends the basic stylesheet concepts and adds some very useful abilities:nested rules, variables, mixins, selector inheritance
Every time you edit any file in /s/stylesheets/src/
, the destination /s/stylesheets/css/site.css
is automatically regenerated by libsass. This takes less than a second, so you can see the results almost immediately. Remember that to see changes in the staging site you must be logged into the CMS in your web browser. You should not edit the site.css file directly, as any changes you make will be overwritten.
If you don’t want to bother with learning SCSS that’s fine. Just write ordinary CSS in the site.scss file. As your stylesheets become more complex, you will find that SCSS gives you valuable shortcuts to achieving what you want and you will never want to go back.
If you would like to break up your stylesheets into more manageable pieces, add another import statement under the 'base' import like this:
@import "colours";
Then create a file /s/stylesheets/src/_colours.scss
(with the underscore). When you make changes to that file, onCourse will automatically merge any content from _colours.scss into the main css for your site.
Look through the default styles for variables which you can easily modify to change your site. For example, override $bodyFontFamily
in order to change the font right through your site. Or change $primaryColor
, $secondaryColor
and $containerWidth
.
Updated 5 months ago