Styles
Existing styles
In the EDS project, the boilerplate template has put styles in styles/
- fonts.css
- lazy-styles.css
- styles.css
Activity: Make dev branch & Update Styles
In your EDS project, create a git branch with your name as a prefix.
git checkout -b <name>-styles
Open styles../styles.css. Replace it entirely with the following:
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
:root {
/* colors */
--primary-color: rgb(255 234 3); /* WKND primary color */
--secondary-color: rgb(32 32 32); /* Secondary brand color */
--background-color: white; /* Background color */
--light-color: rgb(235 235 235); /* Light Background color */
--dark-color: var(--secondary-color); /* Dark text color */
--text-color: var(--secondary-color); /* Default text color */
--link-color: var(--text-color); /* Link color */
--link-hover-color: black; /* Base hover color */
/* fonts */
--body-font-family: 'Source Sans Pro', sans-serif; /* Heading font */
--heading-font-family: 'Asar', sans-serif; /* Body font */
/* body sizes */
--body-font-size-m: 22px;
--body-font-size-s: 19px;
--body-font-size-xs: 17px;
/* heading sizes */
--heading-font-size-xxl: 55px;
--heading-font-size-xl: 44px;
--heading-font-size-l: 34px;
--heading-font-size-m: 27px;
--heading-font-size-s: 24px;
--heading-font-size-xs: 22px;
/* nav height */
--nav-height: 64px;
}
/* Add fallback fonts here */
@media (width >= 900px) {
:root {
/* body sizes */
--body-font-size-m: 18px;
--body-font-size-s: 16px;
--body-font-size-xs: 14px;
/* heading sizes */
--heading-font-size-xxl: 45px;
--heading-font-size-xl: 36px;
--heading-font-size-l: 28px;
--heading-font-size-m: 22px;
--heading-font-size-s: 20px;
--heading-font-size-xs: 18px;
}
}
body {
display: none;
margin: 0;
background-color: var(--background-color);
color: var(--text-color);
font-family: var(--body-font-family);
font-size: var(--body-font-size-m);
line-height: 1.6;
}
body.appear {
display: block;
}
header {
height: var(--nav-height);
}
header .header,
footer .footer {
visibility: hidden;
}
header .header[data-block-status="loaded"],
footer .footer[data-block-status="loaded"] {
visibility: visible;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin-top: 0.8em;
margin-bottom: 0.25em;
font-family: var(--heading-font-family);
font-weight: 600;
line-height: 1.25;
scroll-margin: 40px;
}
h1 { font-size: var(--heading-font-size-xxl); }
h2 { font-size: var(--heading-font-size-xl); } /* Set font size for h2 */
/* Add a partial yellow underline under H2 */
h2::after {
border-bottom: 2px solid var(--primary-color); /* Yellow underline */
content: "";
display: block;
padding-top: 8px;
width: 84px;
}
h3 { font-size: var(--heading-font-size-l); }
h4 { font-size: var(--heading-font-size-m); }
h5 { font-size: var(--heading-font-size-s); }
h6 { font-size: var(--heading-font-size-xs); }
p,
dl,
ol,
ul,
pre,
blockquote {
margin-top: 0.8em;
margin-bottom: 0.25em;
}
code,
pre {
font-size: var(--body-font-size-s);
}
pre {
padding: 16px;
border-radius: 8px;
background-color: var(--light-color);
overflow-x: auto;
white-space: pre;
}
main > div {
margin: 40px 16px;
}
input,
textarea,
select,
button {
font: inherit;
}
/* links */
a:any-link {
color: var(--link-color);
text-decoration: none;
word-break: break-all;
}
a:hover {
color: var(--link-hover-color);
text-decoration: underline;
}
/* buttons */
a.button:any-link,
button {
box-sizing: border-box;
display: inline-block;
max-width: 100%;
margin: 12px 0;
border: 2px solid transparent;
padding: 0.5em 1.2em;
font-family: var(--body-font-family);
font-style: normal;
font-weight: 500;
line-height: 1.25;
text-align: center;
text-decoration: none;
cursor: pointer;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
/* WKND specific treatments */
text-transform: uppercase;
background-color: var(--primary-color);
color: var(--dark-color);
border-radius: 0;
}
a.button:hover,
a.button:focus,
button:hover,
button:focus {
background-color: var(--link-hover-color);
cursor: pointer;
}
button:disabled,
button:disabled:hover {
background-color: var(--light-color);
cursor: unset;
}
a.button.secondary,
button.secondary {
background-color: unset;
border: 2px solid currentcolor;
color: var(--text-color);
}
main img {
max-width: 100%;
width: auto;
height: auto;
}
.icon {
display: inline-block;
height: 24px;
width: 24px;
}
.icon img {
height: 100%;
width: 100%;
}
/* sections */
main > .section {
margin: 40px 0;
}
main > .section > div {
max-width: 1200px;
margin: auto;
padding: 0 24px;
}
main > .section:first-of-type {
margin-top: 0;
}
@media (width >= 900px) {
main > .section > div {
padding: 0 32px;
}
}
/* section metadata */
main .section.light,
main .section.highlight {
background-color: var(--light-color);
margin: 0;
padding: 40px 0;
}
Open styles/fonts.css. Replace it entirely with the following:
@font-face {
font-family: Asar;
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("https://fonts.gstatic.com/s/asar/v22/sZlLdRyI6TBIbkEaDZtQS6A.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Source Sans Pro';
font-style: italic;
font-weight: 300;
font-display: swap;
src: url("https://fonts.gstatic.com/s/sourcesanspro/v22/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZZMkids18S0xR41.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Source Sans Pro';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("https://fonts.gstatic.com/s/sourcesanspro/v22/6xK1dSBYKcSV-LCoeQqfX1RYOo3qPZ7nsDJB9cme.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Source Sans Pro';
font-style: italic;
font-weight: 600;
font-display: swap;
src: url("https://fonts.gstatic.com/s/sourcesanspro/v22/6xKwdSBYKcSV-LCoeQqfX1RYOo3qPZY4lCds18S0xR41.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("https://fonts.gstatic.com/s/sourcesanspro/v22/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu3cOWxw.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("https://fonts.gstatic.com/s/sourcesanspro/v22/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7lujVj9w.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("https://fonts.gstatic.com/s/sourcesanspro/v22/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu3cOWxw.woff2") format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
View http://localhost:3000 and see the updated styling. Force refresh if needed.
Run the linter:
npm run lint:fix
Add and commit the files:
git add .
git commit -m 'site style update'
Now, push the branch to GitHub
git push origin <name>-styles
Go to your GitHub page for the project’s repository https://github.com/ercot-central/www-site. On the right, there should be an entry under Deployments named styles.
Open a new browser tab and go to https://<name>-styles--eds-<name>--ercot-central.aem.page to see the deployed code.
End of activity
Activity: Merge styles into original branch
In your local project, switch back to your bane branch.
git checkout <name>
Merge the styles branch into <name>
git merge <name>-styles
Now push the changes to GitHub.
git push
Go to https://main--eds-name--ercot-central.aem.page and view the styles deployed to EDS.
End of activity
Reference Links
Add website branding | Adobe Experience Manager
Development Collaboration and Good Practices
Web Performance, Keeping your Lighthouse Score 100.
Does Edge Delivery Services support inline text styling within a paragraph?