This projects uses https://github.com/andybelldesign/hylia
npm start
npm run production
npm run sass:process
npm run sass:tokens
Before you can use the CMS, you need to do some config in Netlify. Luckily they provide a very handy guide to get started.
In short, though:
- Once you’ve set up the site on Netlify, go to “Settings” > “Identity” and enable Identity
- Scroll down to the “Git Gateway” area, click “Enable Git Gateway” and follow the steps
- Click the “Identity” tab at the top
- Once you’ve enabled identity, click “Invite Users”
- Check the invite link in your inbox and click the link in the email that’s sent to you
- Set a password in the popup box
- Go to
/admin
on your site and login - You’re in and ready to edit your content!
Although Hylia has a pretty simple design, you can configure the core design tokens that control the colours, size ratio and fonts.
Note: Credit must be given to the hard work Jina Anne did in order for the concept of design tokens to even exist. You should watch this video, then read this article and then sign up for this course to expand your knowledge.
To change the design tokens in the CMS, find the “Globals” in the sidebar then in the presented options, select “Theme Settings”.
To change the design tokens directly, edit _src/data/tokens.json
.
The tokens are converted into maps that the Sass uses to compile the front-end CSS, so make sure that you maintain the correct structure of tokens.json
.
Your version of Hylia ships with a Styleguide by default. You can see a demo of the Styleguide at https://hylia.website/styleguide/.
You can edit the Styleguide by opening src/styleguide.njk
. If you don’t want the Styleguide, delete that file and the page will vanish.
Hylia is based on the WIP v2 version of Stalfos, which currently has no documentation (I know, I’m bad). Here is some very basic documentation for elements of the new framework that you will encounter on this project.
The whole Sass system is powered by central config file, which lives here: _src/scss/_config.scss
.
Before Sass is compiled, a _tokens.scss
file is generated from the design tokens config which is required.
Key elements:
$stalfos-size-scale
: A token driven size scale which by default, is a “Major Third” scale$stalfos-colors
: A token driven map of colours$stalfos-util-prefix
: All pre-built, framework utilities will have this prefix. Example: the wrapper utility is '.sf-wrapper' because the default prefix is 'sf-'$metrics
: Various misc metrics to use around the site$stalfos-config
: This powers everything from utility class generation to breakpoints to enabling/disabling pre-built components/utilities
The utility class generator lets you generate whatever you want, with no opinions on class name or properties affected.
To add a new class, add another item to the exists $stalfos-config
map. This example adds a utility for floating elements.
'float':('items':('left':'left','right': 'right'
),
'output': 'responsive',
'property': 'float'
);
The output
is set to responsive
which means every breakpoint will generate a prefixed class for itself. If you only wanted elements to float left in the md
breakpoint, you’d now be able to add a class of md:float-left
to your HTML elements.
If you only want standard utility classes generating, set the output
to standard
.
Function tries to match the passed $key
with the $stalfos-colors
map. Returns null if it can’t find a match.
Returns back a 1 dimensional (key value pair) config value if available.
Function tries to match the passed $ratio-key
with the $stalfos-size-scale
. Returns null if it can’t find a match.
Grabs the property and value of one of the $stalfos-config utilities
that the generator will generate a class for.
Pass in the key of one of your breakpoints set in $stalfos-config['breakpoints']
and this mixin will generate the @media
query with your configured value.
Hylia has Netlify CMS pre-configured as standard. You can customise the configuration by editing src/admin/config.yml
.
The basic CMS setup allows you to edit the following:
- Home page: Edit the content on your homepage
- Posts: Create and edit blog posts
- Generic pages: Create generic pages that use a similar layout to posts
- Global site data: Various bits of global site data such as your url, title, posts per page and author details
- Navigation: Edit your primary navigation items
- Theme: Edit the design tokens that power the site’s theme