Welcome to Jeremy Builds, a site openly sharing and documenting both the design and code process of Jeremy Barnes through invididual projects.
Now that I have my basic Gatsby site set up, I’d like to start defining my CSS styles. I prefer to start with styles because they have global impact, and there is an abundance of shared code ( several components on your site should use the same colors, typefaces, spacing units, etc ). It’s also an opportunity for me to implement DRY (don’t repeat yourself) principles into my code base immediately.
// for illustration purposes:// a color objectconst color = {primary: "#1200E5",black: "#19191A",gray9: "#3D3D40",gray8: "#7D7D82",}// a react componentconst Header = () => {return (<h1 style={{color: color.primary}}>Hello World</h1>)}
export const color = {// paletteprimary: "#1200E5", // blue backgroundyellow: "#F0C800",green: "#00E5BF",magenta: "#E500BF",// monochromeblack: "#19191A",gray9: "#3D3D40",gray8: "#7D7D82",}export const spacing = {padding: {xxsmall: 5,xsmall: 15,small: 30,medium: 45,large: 60,xlarge: 75,xxlarge: 90,xxxlarge: 120,},borderRadius: {large: 20,medium: 15,small: 8,xsmall: 4,},}export const typography = {family: {display: "GT-Pressura-Pro-Mono-Regular",displayBold: "GT-Pressura-Pro-Mono-Bold",primary: "Calibre-Regular",code: `"IBM Plex Mono", monospace`,},weight: {regular: "400",medium: "600",bold: "800",},size: {s1: 1.3,s2: 1.6,s3: 1.8,m1: 2.2,m2: 2.6,l1: 3.4,l2: 4.8,l3: 6.4,xl1: 20,},}
// Navigation.jsimport { color, spacing, typography } from "./styles.js"const Navigation = () => {return (<div style={{color: color.magenta,fontSize: `${typography.size.s3}rem`,margin:`${spacing.padding.xxlarge}px`}}>my navigation</div>)}
In my previous code post, I gave an overview of Gatsby, Contentful, and Netlify, and how these three technologies will form the foundation for my new blog, Bytesize Dev. To initiate my project, I’ll start by creating a new Gatsby site. I won’t be walking through a comprehensive setup guide, but Gatsby does have great docs and tutorials for getting started. Furthermore, Gatsby offers a wealth of templates to build from. I particularly like their hello world template. It’s a bare essentials setup that gives you the structure of a basic Gatsby site, without any extra bells or whistles. Which, for me, means less I have to remove in the long run. Once I’ve got the Gatsby CLI installed, I’ll run the following command to initiate a new site:
# create a new Gatsby site using the hello-world startergatsby new bytesize-dev https://github.com/gatsbyjs/gatsby-starter-hello-world
cd bytesize-devgatsby develop
http://localhost:8002/___graphql
http://localhost:8002/___playground
Welcome back to round two of the open code process around Bytesize Dev, a blog I’m building for developers. In my previous post, I spoke about the JAMstack, and how this collective of technology is driving the next generation of website development and management. In this post, I’ll be covering my tools of choice for my website. And then, from here on out, we’ll be jumping into the code and implementation. So, before building a website, I like to understand what kind of workflows, information architecture, and customization this website will need to support. At a high level for my blog, I need a way to display content ( Javascript ), a way to manage content ( a CMS ), and a way to deploy my site ( a hosting service ). At the risk of getting lost in the weeds, I’d like to dive into each of these areas for just a minute.
Over the next few months, I will be documenting my process for a website I am building called “Bytesize Dev.” The website will be a blog full of code snippets, musings, and methodologies for developers. In general, when I set up a new dev project, my first considerations are — what tools am I using to build this? And, what is my workflow?
Through the years, I have narrowed my essential tools down to React as a Framework, and more recently the JAMstack as an approach. The JAM stands for Javascript, API’s, and Markup. I find JAMstack WTF to be a helpful site for any one who is new to this idea. At it’s core though, JAMstack aims to empower developers to make and deploy secure, performant sites without all of the hassle of strenuous database management and devops.