1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2025-01-03 10:25:00 +01:00

switch back to gatsby-plugin-svgr

This commit is contained in:
Matthias Kretschmann 2018-09-20 19:06:46 +02:00
parent d2dba49158
commit 0ce5c05de5
Signed by: m
GPG Key ID: 606EEEF3C479A91F
7 changed files with 29 additions and 24 deletions

View File

@ -87,13 +87,13 @@ All project images use one single component defined in [`src/components/molecule
### 💎 Importing SVG assets ### 💎 Importing SVG assets
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: All SVG assets under `src/images/` will be converted to React components with the help of [gatsby-plugin-svgr](https://github.com/zabute/gatsby-plugin-svgr). Makes use of [SVGR](https://github.com/smooth-code/svgr) so SVG assets can be imported like so:
```js ```js
import Logo from './components/svg/Logo' import { ReactComponent as Logo } from './components/svg/Logo'
```
That's done with a simple bash script under [`scripts/svg.sh`](scripts/svg.sh) <Logo />
```
### 🍬 Typekit component ### 🍬 Typekit component

View File

@ -50,6 +50,12 @@ module.exports = {
path: path.join(__dirname, 'src', 'images') path: path.join(__dirname, 'src', 'images')
} }
}, },
{
resolve: 'gatsby-plugin-svgr',
options: {
icon: true
}
},
{ {
resolve: 'gatsby-plugin-matomo', resolve: 'gatsby-plugin-matomo',
options: { options: {

View File

@ -10,15 +10,14 @@
"start": "npm run dev", "start": "npm run dev",
"lint:js": "eslint ./gatsby-*.js && eslint ./src/**/*.{js,jsx}", "lint:js": "eslint ./gatsby-*.js && eslint ./src/**/*.{js,jsx}",
"lint:css": "stylelint ./src/**/*.{css,scss}", "lint:css": "stylelint ./src/**/*.{css,scss}",
"lint": "npm run svg && npm run lint:js && npm run lint:css", "lint": "npm run lint:js && npm run lint:css",
"build": "npm run svg && ./node_modules/gatsby/dist/bin/gatsby.js build", "build": "./node_modules/gatsby/dist/bin/gatsby.js build",
"dev": "npm run svg && ./node_modules/gatsby/dist/bin/gatsby.js develop", "dev": "./node_modules/gatsby/dist/bin/gatsby.js develop",
"format": "prettier --write 'src/**/*.{js,jsx}'", "format": "prettier --write 'src/**/*.{js,jsx}'",
"format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'", "format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'",
"test": "npm run lint && ./node_modules/.bin/ava **/*.test.js --verbose", "test": "npm run lint && ./node_modules/.bin/ava **/*.test.js --verbose",
"deploy": "./scripts/deploy.sh", "deploy": "./scripts/deploy.sh",
"new": "node ./scripts/new.js", "new": "node ./scripts/new.js"
"svg": "./scripts/svg.sh"
}, },
"dependencies": { "dependencies": {
"file-saver": "^1.3.8", "file-saver": "^1.3.8",
@ -31,6 +30,7 @@
"gatsby-plugin-sass": "^2.0.0", "gatsby-plugin-sass": "^2.0.0",
"gatsby-plugin-sharp": "^2.0.0", "gatsby-plugin-sharp": "^2.0.0",
"gatsby-plugin-sitemap": "^2.0.0", "gatsby-plugin-sitemap": "^2.0.0",
"gatsby-plugin-svgr": "next",
"gatsby-source-filesystem": "^2.0.1", "gatsby-source-filesystem": "^2.0.1",
"gatsby-transformer-json": "^2.1.1", "gatsby-transformer-json": "^2.1.1",
"gatsby-transformer-sharp": "^2.1.1", "gatsby-transformer-sharp": "^2.1.1",
@ -48,7 +48,6 @@
"vcf": "^2.0.1" "vcf": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@svgr/cli": "^2.4.1",
"ava": "^0.25.0", "ava": "^0.25.0",
"babel-eslint": "^9.0.0", "babel-eslint": "^9.0.0",
"chrome-launcher": "^0.10.4", "chrome-launcher": "^0.10.4",

View File

@ -4,7 +4,7 @@ import { StaticQuery, graphql } from 'gatsby'
import posed from 'react-pose' import posed from 'react-pose'
import { moveInBottom } from '../atoms/Transitions' import { moveInBottom } from '../atoms/Transitions'
import Logo from '../svg/Logo' import { ReactComponent as Logo } from '../../images/logo.svg'
import styles from './LogoUnit.module.scss' import styles from './LogoUnit.module.scss'
const query = graphql` const query = graphql`

View File

@ -4,11 +4,11 @@ import { StaticQuery, graphql } from 'gatsby'
import posed from 'react-pose' import posed from 'react-pose'
import { moveInTop } from '../atoms/Transitions' import { moveInTop } from '../atoms/Transitions'
import Email from '../svg/Email' import { ReactComponent as Email } from '../../images/email.svg'
import Blog from '../svg/Blog' import { ReactComponent as Blog } from '../../images/blog.svg'
import Twitter from '../svg/Twitter' import { ReactComponent as Twitter } from '../../images/twitter.svg'
import GitHub from '../svg/Github' import { ReactComponent as GitHub } from '../../images/github.svg'
import Dribbble from '../svg/Dribbble' import { ReactComponent as Dribbble } from '../../images/dribbble.svg'
import icons from '../atoms/Icons.module.scss' import icons from '../atoms/Icons.module.scss'
import styles from './Networks.module.scss' import styles from './Networks.module.scss'

View File

@ -2,12 +2,12 @@ import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Button from '../atoms/Button' import Button from '../atoms/Button'
import Link from '../svg/Link' import { ReactComponent as Link } from '../../images/link.svg'
import Download from '../svg/Download' import { ReactComponent as Download } from '../../images/download.svg'
import Info from '../svg/Info' import { ReactComponent as Info } from '../../images/info.svg'
import Styleguide from '../svg/Styleguide' import { ReactComponent as Styleguide } from '../../images/styleguide.svg'
import GitHub from '../svg/Github' import { ReactComponent as GitHub } from '../../images/github.svg'
import Dribbble from '../svg/Dribbble' import { ReactComponent as Dribbble } from '../../images/dribbble.svg'
import icons from '../atoms/Icons.module.scss' import icons from '../atoms/Icons.module.scss'
import styles from './ProjectLinks.module.scss' import styles from './ProjectLinks.module.scss'

View File

@ -5,8 +5,8 @@ import posed from 'react-pose'
import { Consumer } from '../../store/createContext' import { Consumer } from '../../store/createContext'
import { fadeIn } from '../atoms/Transitions' import { fadeIn } from '../atoms/Transitions'
import Day from '../svg/Day' import { ReactComponent as Day } from '../../images/day.svg'
import Night from '../svg/Night' import { ReactComponent as Night } from '../../images/night.svg'
import styles from './ThemeSwitch.module.scss' import styles from './ThemeSwitch.module.scss'
const Animation = posed.aside(fadeIn) const Animation = posed.aside(fadeIn)