1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-11-15 01:25:25 +01:00
portfolio/README.md

176 lines
7.3 KiB
Markdown
Raw Normal View History

2018-05-14 02:44:11 +02:00
<p align="center">
2018-09-17 19:00:38 +02:00
<a href="https://matthiaskretschmann.com"><img src="src/images/github-header.png" /></a>
2018-05-14 02:44:11 +02:00
</p>
<p align="center">
<strong>👔 Portfolio thingy, built with <a href="https://www.gatsbyjs.org">Gatsby</a>.</strong>
</p>
<p align="center">
<a href="https://matthiaskretschmann.com">matthiaskretschmann.com</a>
</p>
<p align="center">
2018-05-22 22:41:59 +02:00
<a href="https://travis-ci.com/kremalicious/portfolio"><img src="https://travis-ci.com/kremalicious/portfolio.svg?branch=master" /></a>
<a href="https://codeclimate.com/github/kremalicious/portfolio/maintainability"><img src="https://api.codeclimate.com/v1/badges/8f561ec93e0f8c6b15d9/maintainability" /></a>
2018-08-27 20:10:38 +02:00
<a href="https://www.codacy.com/app/kremalicious/portfolio?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=kremalicious/portfolio&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/c3bccea20dfd49c59b3956afd60998d8"/></a>
2018-05-14 02:44:11 +02:00
<a href="https://greenkeeper.io/"><img src="https://badges.greenkeeper.io/kremalicious/portfolio.svg" /></a>
</p>
2018-05-14 01:50:11 +02:00
## Table of Contents
2018-09-20 14:45:07 +02:00
- [🎉 Features](#-features)
- [⛵️ Lighthouse score](#-lighthouse-score)
- [💍 One data file to rule all pages](#-one-data-file-to-rule-all-pages)
- [💅 Theme switcher](#-theme-switcher)
- [🏆 SEO component](#-seo-component)
- [📇 Client-side vCard creation](#-client-side-vcard-creation)
- [💫 Page transitions](#-page-transitions)
- [📈 Matomo (formerly Piwik) analytics tracking](#-matomo-formerly-piwik-analytics-tracking)
- [🖼 Project images](#-project-images)
- [💎 Importing SVG assets](#-importing-svg-assets)
- [🍬 Typekit component](#-typekit-component)
- [✨ Development](#-development)
- [🔮 Linting](#-linting)
- [🎈 Add a new project](#-add-a-new-project)
- [🚚 Deployment](#-deployment)
- [🏛 Licenses](#-licenses)
2018-05-14 01:50:11 +02:00
---
2018-09-17 19:00:38 +02:00
## 🎉 Features
2018-05-14 01:50:11 +02:00
2018-07-15 00:26:35 +02:00
The whole [portfolio](https://matthiaskretschmann.com) is a React-based Single Page App built with [Gatsby v2](https://www.gatsbyjs.org).
2018-05-14 01:50:11 +02:00
2018-09-17 19:00:38 +02:00
### ⛵️ Lighthouse score
2018-09-15 20:26:41 +02:00
2018-09-17 00:43:52 +02:00
[![Lighthouse scores](https://lighthouse.now.sh/?perf=100&pwa=100&a11y=100&bp=100&seo=100)](https://travis-ci.com/kremalicious/portfolio)
2018-09-15 20:26:41 +02:00
2018-09-17 19:00:38 +02:00
### 💍 One data file to rule all pages
2018-05-14 01:50:11 +02:00
All content is powered by one YAML file, [`data/projects.yml`](data/projects.yml) where all the portfolio's projects are defined. The project description itself is transformed from Markdown.
Gatsby automatically creates pages from each item in that file utilizing the [`src/templates/Project.jsx`](src/templates/Project.jsx) template.
2018-09-17 19:00:38 +02:00
### 💅 Theme switcher
2018-05-14 01:50:11 +02:00
Includes a theme switcher which allows user to toggle between a light and a dark theme. Switching between them also happens automatically based on time of day.
If you want to know how, have a look at the respective component under [`src/components/molecules/ThemeSwitch.jsx`](src/components/molecules/ThemeSwitch.jsx)
2018-09-17 19:00:38 +02:00
### 🏆 SEO component
2018-05-14 01:50:11 +02:00
Includes a SEO component which automatically switches all required `meta` tags for search engines, Twitter Cards, and Facebook OpenGraph tags based on the browsed route/page.
If you want to know how, have a look at the respective component under [`src/components/atoms/SEO.jsx`](src/components/atoms/SEO.jsx)
2018-09-17 19:00:38 +02:00
### 📇 Client-side vCard creation
2018-05-14 01:50:11 +02:00
The _Add to addressbook_ link in the footer automatically creates a downloadable vCard file on the client-side, based on data defined in `data/meta.yml`.
If you want to know how, have a look at the respective component under [`src/components/atoms/Vcard.jsx`](src/components/atoms/Vcard.jsx)
2018-09-20 14:13:32 +02:00
### 💫 Page transitions
2018-09-20 14:45:07 +02:00
Includes mechanism for transitioning between route changes with full page transitions defined with [react-pose](https://popmotion.io/pose/). Mechanism ~~stolen~~ inspired by [gatsby-universal](https://github.com/fabe/gatsby-universal).
2018-09-20 14:13:32 +02:00
2018-09-17 19:00:38 +02:00
### 📈 Matomo (formerly Piwik) analytics tracking
2018-05-14 01:50:11 +02:00
Site sends usage statistics to my own [Matomo](https://matomo.org) installation. To make this work in Gatsby, I created and open sourced a plugin, [gatsby-plugin-matomo](https://github.com/kremalicious/gatsby-plugin-matomo), which is in use on this site.
2018-09-17 19:00:38 +02:00
### 🖼 Project images
2018-05-14 01:50:11 +02:00
All project images live under `src/images` and are automatically attached to each project based on the inclusion of the project's `slug` in their filenames.
All project images make use of the excellent [gatsby-image](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-image) plugin, working in tandem with [gatsby-plugin-sharp](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-sharp) and [gatsby-transformer-sharp](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-transformer-sharp).
All together, Gatsby automatically generates all required image sizes for delivering responsible, responsive images to visitors, including lazy loading of all images. Also includes the [intersection-observer polyfill](https://github.com/w3c/IntersectionObserver) to make lazy loading work properly in Safari.
2018-09-17 21:30:04 +02:00
All project images use one single component defined in [`src/components/molecules/ProjectImage.jsx`](src/components/molecules/ProjectImage.jsx). In there, one main GraphQL query fragment is defined, which then gets used throughout other GraphQL queries.
2018-05-14 01:50:11 +02:00
2018-09-17 19:00:38 +02:00
### 💎 Importing SVG assets
2018-05-14 01:50:11 +02:00
2018-06-23 14:49:40 +02:00
All SVG assets under `src/images/` will be converted to React components before every build. Makes use of `SVGR` so SVG assets can be imported like so:
2018-05-14 01:50:11 +02:00
```js
2018-06-23 14:49:40 +02:00
import Logo from './components/svg/Logo'
2018-05-14 01:50:11 +02:00
```
2018-03-18 20:39:18 +01:00
2018-09-17 21:30:04 +02:00
That's done with a simple bash script under [`scripts/svg.sh`](scripts/svg.sh)
2018-07-15 00:26:35 +02:00
2018-09-17 19:00:38 +02:00
### 🍬 Typekit component
2018-07-15 00:26:35 +02:00
Includes a component for adding the Typekit snippet.
If you want to know how, have a look at the respective component under [`src/components/atoms/Typekit.jsx`](src/components/atoms/Typekit.jsx)
2018-09-17 19:00:38 +02:00
## ✨ Development
2018-03-18 20:39:18 +01:00
```bash
2018-05-14 01:50:11 +02:00
git clone git@github.com:kremalicious/portfolio.git
cd portfolio/
2018-03-18 20:39:18 +01:00
npm i
npm start
```
2018-04-21 15:02:56 +02:00
2018-09-17 19:00:38 +02:00
### 🔮 Linting
2018-04-22 23:51:50 +02:00
2018-05-14 01:50:11 +02:00
ESlint, Prettier, and Stylelint are setup for all linting purposes:
```bash
npm run lint
```
To automatically format all code files:
```bash
npm run format
npm run format:css
```
2018-09-17 19:00:38 +02:00
### 🎈 Add a new project
2018-05-14 01:50:11 +02:00
To add a new project, run the following command. This adds a new item to the top of the `projects.yml` file, creating the title & slug from the argument:
```bash
npm run new -- "Hello"
```
Then continue modifying the new entry in [`data/projects.yml`](data/projects.yml).
Finally, add as many images as needed with the file name format and put into `src/images/`:
```
portfolio-SLUG-01.png
portfolio-SLUG-02.png
portfolio-SLUG-03.png
...
2018-04-22 23:51:50 +02:00
```
2018-09-17 19:00:38 +02:00
## 🚚 Deployment
2018-04-21 15:02:56 +02:00
2018-05-14 01:50:11 +02:00
Automatic deployments are triggered upon successful tests & builds on Travis:
2018-06-23 14:49:40 +02:00
- push to `master` initiates a live deployment
- any Pull Request, and subsequent pushes to it, initiates a beta deployment
2018-05-14 01:50:11 +02:00
The deploy command simply calls the [`scripts/deploy.sh`](scripts/deploy.sh) script, syncing the contents of the `public/` folder to S3:
2018-04-21 15:02:56 +02:00
```bash
npm run deploy
```
2018-05-14 01:50:11 +02:00
The deploymeng script can be used locally too, the branch checks are only happening for Travis builds, allowing to deploy any branch from local machine.
2018-09-17 19:00:38 +02:00
## 🏛 Licenses
2018-05-14 01:50:11 +02:00
All images and projects are plain ol' copyright:
**© Copyright 2018 Matthias Kretschmann**
Most displayed projects are subject to the copyright of their respective owners.
All the rest, like all code and documentation, is under:
**The MIT License**
[Full MIT license text](LICENSE)