How to add a banner image to a section in the college theme with SCSS.
Instructions
Follow the repo’s README.md instructions to begin the code editing workflow.
Place your image file (1600x225 px) in [site-dir]/branding/sections in your college site folder (e.g. rsc/branding/sections/admissions-records.png
)Adding banner images is accomplished through SCSS changes that require Developer access to your college website on the Pantheon platform. The process involves creating a Multidev branch of your college website, cloning the Multidev locally using GIT, making the SCSS changes and compiling them with a SASS compiler, testing your changes locally, and pushing them into your Multidev branch for further online testing. Once you have tested your changes on the Multidev, you can submit a merge request via Slack to have your changes merged to the development environment.
Instructions
Before you begin, please read through the Development section of the Knowledge Base. Make sure you can make a Merge request in order to complete the following steps.
Get the CSS class name
Open a browser and navigate to the a page on your college website with the image to replace
...
Hover over the image and right click and select “Inspect” to view HTML source for the image
...
Find the
div id="branding-img"
element wrapper. Note the class names for this div element
...
Code Block | ||
---|---|---|
| ||
<div id="branding-img" class="admissions-records students"> |
...
Prepare and place the image
Prepare an image with the height and width dimensions of 1600x225 pixels
Name the image the same as the CSS class name you found above, make sure it is all lowercase letters and includes dashes instead of spaces
e.g. rename Admissions and Records1600x255.PNG
to admissions-records.png
Place the image into its respective branding folder, create the folder if one doesn’t exist
Award:
docroot/sites/default/branding/awards
e.g.docroot/sites/default/branding/awards/airline-operations.png
Location:
docroot/sites/default/branding/locations
e.g.docroot/sites/default/branding/locations/conference-center.png
Program:
docroot/sites/default/branding/programs
e.g.docroot/sites/default/branding/programs/aviation.png
Section:
docroot/sites/default/branding/sections
e.g.docroot/sites/default/branding/sections/admissions-records.png
Add the style
In your code editor, open
...
docroot/sites/default/themes/[site-
...
theme]/partials/_branding.scss
...
Add a line for your
...
banner image using the class name noted earlier
...
in the appropriate area: parent, section, or sub-section
Code Block | ||
---|---|---|
| ||
/* Section */ #branding-img.admissions-records { background-image:url(#{$site_branding_path}/sections/admissions-records.png); } |
Save and recompile your college's SCSS folder
...
If using the Lando
...
development stack, you can use
lando gulp
The
git status
command will show your modified_something.scss
files and the recompiledstyle.css
andstyle.css.map
files.
...
Refresh your web browser
...
, you may need to clear Drupal
...
caches to see changes
Merge Changes to Pantheon
Related articles
Filter by label (Content by label) | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...