diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 00000000..84ccb8b8 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,5 @@ +version: '2' +checks: + method-lines: + config: + threshold: 50 # Gatsby's StaticQuery makes render functions pretty long diff --git a/LICENSE b/LICENSE index fc487c46..c4331e38 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2008-2017 Matthias Kretschmann +Copyright (c) 2008-2018 Matthias Kretschmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/LICENSE-content b/LICENSE-content index ac50ae93..5ce29441 100644 --- a/LICENSE-content +++ b/LICENSE-content @@ -1,5 +1,3 @@ -All post content under `_src/_posts` is licensed under a -Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International -License. +All post content under `./content/posts` is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/. diff --git a/LICENSE-photos b/LICENSE-photos index d789f81c..e4e1e1d5 100644 --- a/LICENSE-photos +++ b/LICENSE-photos @@ -1,7 +1,6 @@ -All photos & image assets under `_src/_media`, `_src/assets/img`, and -`assets sheet.psd` are plain ol' copyright. +All photos & image assets under `./content/media`, `./src/images`, and `assets sheet.psd` are plain ol' copyright. -Copyright (c) 2008–2017 Matthias Kretschmann +Copyright (c) 2008–2018 Matthias Kretschmann Don't care if you fork & play with it, but you're not allowed to publish anything from it as a whole without my written permission. diff --git a/README.md b/README.md index c02e6c74..3e7942c3 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,18 @@ # blog -> [kremalicious.com](http://kremalicious.com) built with [Gatsby](http://gatsbyjs.org). Neat. +> My blog [kremalicious.com](http://kremalicious.com) built with [Gatsby](http://gatsbyjs.org). Neat. [![Build Status](https://travis-ci.com/kremalicious/kremalicious3.svg?branch=master)](https://travis-ci.com/kremalicious/kremalicious3) +[![Maintainability](https://api.codeclimate.com/v1/badges/1b7f317ccca9a430ee59/maintainability)](https://codeclimate.com/github/kremalicious/kremalicious3/maintainability) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/22716f4e00d14df8991af76384193953)](https://www.codacy.com/app/kremalicious/kremalicious3) [![Greenkeeper badge](https://badges.greenkeeper.io/kremalicious/kremalicious3.svg)](https://greenkeeper.io/) ## Requirements You need to have the following tools installed on your development machine before moving on: -- [Node.js](http://nodejs.org/) & [npm](https://npmjs.org/) +- [Node.js](http://nodejs.org/) +- [npm](https://npmjs.org/) ## Get up and running @@ -18,7 +21,7 @@ You need to have the following tools installed on your development machine befor Run the following command from the repository's root folder to install all dependencies. ```bash -npm install +npm i ``` ### Development server @@ -35,21 +38,22 @@ npm run build ## Licenses +The MIT License (MIT) + +except for: + ### Posts Creative Commons License -
-All post content under `_src/_posts` is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. + + +All post content under `./content/posts` is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. ### Photos & images -All photos & image assets under `_src/_media`, `_src/assets/img`, and `assets sheet.psd` are plain ol' copyright. +All photos & image assets under `./content/media`, `./src/images`, and `assets sheet.psd` are plain ol' copyright. Copyright (c) 2008–2018 Matthias Kretschmann Don't care if you fork & play with it, but you're not allowed to publish anything from it as a whole without my written permission. - -### Everything else - -The MIT License (MIT) diff --git a/_src/_assets/js/_menu.js b/_src/_assets/js/_menu.js deleted file mode 100644 index 80546c51..00000000 --- a/_src/_assets/js/_menu.js +++ /dev/null @@ -1,32 +0,0 @@ -/* exported krlcMenu */ - -const krlcMenu = (() => { // eslint-disable-line no-unused-vars - const _config = { - thesite: document.getElementsByClassName('site')[0], - thelink: document.getElementsByClassName('menu-btn')[0], - thepop: document.getElementsByClassName('nav-popover')[0] - } - - const _private = { - toggleMenu() { - _config.thelink.addEventListener('click', e => { - e.preventDefault() - - // Toggle menu - _config.thesite.classList.toggle('has-menu-open') - - // Dont close thepop when you click on thepop - _config.thepop.addEventListener('click', e => { - e.stopPropagation() - }) - - // And dont close thepop now - e.stopPropagation() - }) - } - } - - return { - init: _private.toggleMenu - } -})(); // eslint-disable-line semi diff --git a/_src/_assets/js/_modals.js b/_src/_assets/js/_modals.js deleted file mode 100644 index c0376d5f..00000000 --- a/_src/_assets/js/_modals.js +++ /dev/null @@ -1,99 +0,0 @@ -// -// Vex modals -// - -/* global vex, fetch, ClipboardJS, QRious */ -/* exported krlcModals */ - -/* eslint-disable spaced-comment */ -//=require vex-js/dist/js/vex.combined.js -//=require clipboard/dist/clipboard.js -//=require qrious/dist/qrious.js -/* eslint-enable spaced-comment */ - -const krlcModals = (() => { // eslint-disable-line no-unused-vars - const _config = { - btcVexTriggers: document.querySelectorAll('.js-vex-btc') - } - - let btcAddress - let ethAddress - - const _private = { - getBtcAddress() { - const url = '/api/site.json' - - fetch(url) - .then(res => res.json()) - .then(data_ => { - btcAddress = data_[0].author.bitcoin - ethAddress = data_[0].author.ether - }) - .catch(err => console.error(err)) - - return { btcAddress, ethAddress } - }, - - vexBtc() { - _config.btcVexTriggers.forEach(el => { - el.addEventListener('click', e => { - e.preventDefault() - - vex.defaultOptions.className = 'vex-theme-kremalicious vex-bitcoin' - vex.dialog.buttons.YES.text = 'Close' - vex.open({ unsafeContent: ` -

Say thanks

-
-
-

Bitcoin

- -
${btcAddress}
-
-
-

Ethereum

- -
${ethAddress}
-
-
- ` - }) - - // Generate QR codes - const qrBtc = new QRious({ - element: document.getElementById('qr-btc'), - value: btcAddress - }) - - const qrEth = new QRious({ - element: document.getElementById('qr-eth'), - value: ethAddress - }) - - const qrOptions = { - backgroundAlpha: 0, - foreground: '#6b7f88', - size: 160 - } - - qrBtc.set(qrOptions) - qrEth.set(qrOptions) - - // Clipboard button - const clipboard = new ClipboardJS('.btn') - - clipboard.on('success', e => { - e.trigger.classList.add('success') - e.clearSelection() - }) - }) - }) - } - } - - return { - init() { - _private.getBtcAddress() - _private.vexBtc() - } - } -})(); // eslint-disable-line semi diff --git a/_src/_assets/js/_search.js b/_src/_assets/js/_search.js deleted file mode 100644 index 117250e7..00000000 --- a/_src/_assets/js/_search.js +++ /dev/null @@ -1,90 +0,0 @@ -/* global SimpleJekyllSearch */ -/* exported krlcSearch */ - -/* eslint-disable spaced-comment */ -//=require simple-jekyll-search/dest/simple-jekyll-search.js -/* eslint-enable spaced-comment */ - -const krlcSearch = (() => { // eslint-disable-line no-unused-vars - const _config = { - searchlink: document.getElementsByClassName('search-btn')[0], - searcharea: document.getElementsByClassName('search-area')[0], - searchclose: document.getElementsByClassName('search-close')[0], - searchfield: document.getElementById('search-input'), - searchpop: document.getElementById('search-popover'), - searchresults: document.getElementById('search-results') - } - - const _private = { - searchHide() { - // Revert all search elements - _config.searcharea.classList.remove('animation-slidedown') - _config.searcharea.classList.add('animation-bounceOutUp') - _config.searchpop.classList.add('hide') - document.body.classList.remove('has-search-open') - }, - - searchClose() { - _config.searchclose.addEventListener('click', e => { - e.preventDefault() - - _private.searchHide() - - // Empty search field - _config.searchfield.value = '' - _config.searchfield.blur() - }) - }, - - searchShow() { - _config.searchlink.addEventListener('click', e => { - e.preventDefault() - - // Show search field - _config.searcharea.classList.remove('is-ready', 'animation-bounceOutUp') - _config.searcharea.classList.add('is-ready', 'animation-slidedown') - document.body.classList.add('has-search-open') - - _config.searchfield.focus() - - SimpleJekyllSearch({ // eslint-disable-line new-cap - searchInput: _config.searchfield, - resultsContainer: _config.searchresults, - json: '/api/search.json', - searchResultTemplate: '{title}', - fuzzy: false - }) - - // Hide menu too just in case - if (document.body.classList.contains('has-menu-open')) { - document.body.classList.remove('has-menu-open') - } - - // Dont close thepop when click on thepop - _config.searchpop.addEventListener('click', e => { - e.stopPropagation() - }) - - // Dont close thepop when click on search field - _config.searchfield.addEventListener('click', e => { - e.stopPropagation() - }) - - // And dont close thepop now - e.stopPropagation() - }) - - // Show popup upon first keypress - _config.searchfield.addEventListener('keyup', () => { - _config.searchpop.classList.remove('hide') - }) - - // Listen for close icon - _private.searchClose() - } - } - - return { - init: _private.searchShow - } -})(); // eslint-disable-line semi diff --git a/_src/_assets/js/analytics.js b/_src/_assets/js/analytics.js deleted file mode 100644 index c77dcb17..00000000 --- a/_src/_assets/js/analytics.js +++ /dev/null @@ -1,82 +0,0 @@ -const krlcAnalytics = (() => { // eslint-disable-line no-unused-vars - // - // Track Responsive Breakpoints - // - // stolen & adapted from - // http://philipwalton.com/articles/measuring-your-sites-responsive-breakpoint-usage/ - // - const gaBreakpoints = () => { - // Do nothing in browsers that don't support `window.matchMedia`. - if (!window.matchMedia) { - return - } - - // Prevent rapid breakpoint changes for all firing at once. - let timeout - - const breakpoints = { - xxs: '(max-width: 479px)', - xs: '(min-width: 480px) and (max-width: 767px)', - sm: '(min-width: 768px) and (max-width: 991px)', - md: '(min-width: 992px) and (max-width: 1199px)', - lg: '(min-width: 1200px) and (max-width: 1599px)', - hg: '(min-width: 1600px)' - } - - Object.keys(breakpoints).forEach(breakpoint => { - const mql = window.matchMedia(breakpoints[breakpoint]) - - // Set the initial breakpoint on page load. - if (mql.matches) { - window.ga('set', 'dimension1', breakpoint) - } - - // Update the breakpoint as the matched media changes - mql.addListener(() => { - if (mql.matches) { - clearTimeout(timeout) - timeout = setTimeout(() => { - window.ga('set', 'dimension1', breakpoint) - }, 1000) - } - }) - }) - } - - - // - // Track Viewport - // - const gaViewport = () => { - const width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0) - const height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - const dimensions = width + 'x' + height - - window.ga('set', 'dimension2', dimensions) - } - - - // - // Track Pixel Density - // - const gaPixelDensity = () => { - // Heads up! - // window.devicePixelRatio doesn't work correctly in IE but whatever - const pixeldensity = window.devicePixelRatio - - window.ga('set', 'dimension3', pixeldensity) - } - - - return { - init() { - const dnt = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack - - if (dnt !== 'yes' && dnt !== '1') { - gaBreakpoints() - gaViewport() - gaPixelDensity() - } - } - } -})(); // eslint-disable-line semi diff --git a/_src/_assets/js/kremalicious3.js b/_src/_assets/js/kremalicious3.js deleted file mode 100644 index 2d91b3ce..00000000 --- a/_src/_assets/js/kremalicious3.js +++ /dev/null @@ -1,17 +0,0 @@ -/* global krlcMenu, krlcSearch, krlcModals */ - -/* eslint-disable spaced-comment */ -//=require @webcomponents/webcomponentsjs/webcomponents-bundle.js -//=require time-elements/dist/time-elements.js - -//=include _menu.js -//=include _search.js -//=include _modals.js -/* eslint-enable spaced-comment */ - -// -// Init js modules -// -krlcSearch.init() -krlcMenu.init() -krlcModals.init() diff --git a/_src/_data/colors.yml b/_src/_data/colors.yml deleted file mode 100644 index 73a740ed..00000000 --- a/_src/_data/colors.yml +++ /dev/null @@ -1,14 +0,0 @@ - -- name: brand-dark - hex: '015565' -- name: brand-light - hex: 'e7eef4' -- name: brand-cyan - hex: '3a9085' - -- name: brand-grey - hex: '6b7f88' -- name: brand-grey-light - hex: '96a6ad' -- name: brand-grey-dimmed - hex: 'D8E0E5' diff --git a/_src/api/posts.json b/_src/api/posts.json deleted file mode 100644 index c5ee380b..00000000 --- a/_src/api/posts.json +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: null ---- -[ - {% for post in site.posts %} - { - "title" : {{ post.title | titlecase | jsonify }}, - "excerpt" : {{ post.excerpt | jsonify }}, - "category" : "{{ post.categories | join: ', ' }}", - "tag" : "{{ post.tags | join: ', ' }}", - "url" : "{{ site.url }}{{ post.url }}", - "date" : "{{ post.date }}", - "content" : {{ post.content | jsonify }}, - "image" : "{{ post.image }}", - "author" : "{{ post.author }}", - "layout" : "{{ post.layout }}", - "id" : "{{ post.id }}", - "path" : "{{ post.path }}", - "download" : "{{ post.download }}", - "linkurl" : "{{ post.linkurl }}" - } {% unless forloop.last %},{% endunless %} - {% endfor %} -] diff --git a/_src/api/search.json b/_src/api/search.json deleted file mode 100644 index a15c7e9a..00000000 --- a/_src/api/search.json +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: null ---- -[ - {% for post in site.posts %} - { - "title" : "{{ post.title | strip_html | strip_newlines | titlecase }}", - "excerpt" : "{{ post.excerpt | strip_html | strip_newlines }}", - "category" : "{{ post.categories | join: ', ' }}", - "tag" : "{{ post.tags | join: ', ' }}", - "url" : "{{ site.url }}{{ post.url }}", - "date" : "{{ post.date }}", - "image" : "{{ post.image }}", - "content" : "{{ post.content | strip_html | strip_newlines | xml_escape }}", - "linkurl" : "{{ post.linkurl }}" - } {% unless forloop.last %},{% endunless %} - {% endfor %} -] diff --git a/_src/api/site.json b/_src/api/site.json deleted file mode 100644 index b9015cfb..00000000 --- a/_src/api/site.json +++ /dev/null @@ -1,13 +0,0 @@ ---- ---- -[ - { - "name" : "{{ site.name }}", - "description" : "{{ site.description | xml_escape }}", - "url" : "{{ site.url }}", - "author" : { - {% for item in site.author %}"{{ item[0] }}": "{{ item[1] }}"{% unless forloop.last %},{% endunless %} - {% endfor %} - } - } -] diff --git a/_src/index.html b/_src/index.html deleted file mode 100644 index c6041345..00000000 --- a/_src/index.html +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: base -front_page: true -redirect_from: - - /blog/ - - /topics/howto-and-tutorial/ - - /howto-and-tutorial/ - - /most-popular-stuff-on-kremaliciouscom-in-2008/ - - /canon-eos-50d-officially-announced-and-new-lens/ ---- - -{% if paginator.next_page == 2 %} - {% include featured.html %} -{% endif %} - -
- - {% if paginator.previous_page %} -

Page {{ paginator.page }}

- {% endif %} - - {% for post in paginator.posts %} - - {% include articles.html %} - - {% endfor %} - -
- -{% include paginator.html %} diff --git a/_src/tag.html b/_src/tag.html deleted file mode 100644 index cd9d65bf..00000000 --- a/_src/tag.html +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: base - -title: tags ---- - -
- -
-

Tags

- -
- {% for tag in site.tags %} - - - {{ tag | first }} - - - {% endfor %} -
- -
- -
diff --git a/gatsby-browser.js b/gatsby-browser.js index 3106bf81..78851ef5 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -1,6 +1,4 @@ -exports.onInitialClientRender = () => { - require('./src/styles/base.scss') -} +require('./src/styles/global.scss') exports.onClientEntry = () => { // IntersectionObserver polyfill for gatsby-image (Safari, IE) diff --git a/package.json b/package.json index 4bcc9dd6..97bf54dc 100644 --- a/package.json +++ b/package.json @@ -22,13 +22,11 @@ "last 3 versions" ], "dependencies": { - "clipboard": "^2.0.1", - "exif-js": "^2.3.0", "gatsby": "^2.0.0-rc.0", "gatsby-image": "^2.0.0-rc.0", "gatsby-plugin-catch-links": "^2.0.2-rc.0", "gatsby-plugin-lunr": "^1.1.0", - "gatsby-plugin-matomo": "^0.4.1", + "gatsby-plugin-matomo": "^0.5.0", "gatsby-plugin-react-helmet": "^3.0.0-rc.0", "gatsby-plugin-sass": "^2.0.0-rc.0", "gatsby-plugin-sharp": "^2.0.0-rc.0", @@ -44,10 +42,9 @@ "gatsby-transformer-yaml": "^2.1.1-rc.0", "graphql": "^0.13.2", "intersection-observer": "^0.5.0", - "node-sass": "^4.9.2", + "node-sass": "^4.9.3", "nord": "^0.2.1", "prismjs": "^1.15.0", - "qrious": "^4.0.2", "react": "^16.4.2", "react-clipboard.js": "^2.0.0", "react-dom": "^16.4.2", @@ -56,19 +53,18 @@ "react-qr-svg": "^2.1.0", "react-time": "^4.3.0", "react-transition-group": "^2.4.0", - "slugify": "^1.3.1", - "vex-js": "^4.1.0" + "slugify": "^1.3.1" }, "devDependencies": { "@svgr/cli": "^2.2.0", - "babel-eslint": "^8.2.6", + "babel-eslint": "^9.0.0", "eslint": "^5.4.0", - "eslint-config-prettier": "^2.10.0", + "eslint-config-prettier": "^3.0.1", "eslint-loader": "^2.1.0", "eslint-plugin-graphql": "^2.1.1", "eslint-plugin-prettier": "^2.6.2", "eslint-plugin-react": "^7.11.1", - "prettier": "^1.14.1", + "prettier": "^1.14.2", "prettier-stylelint": "^0.4.2", "stylelint": "^9.5.0", "stylelint-config-css-modules": "^1.3.0", diff --git a/src/styles/base.scss b/src/styles/global.scss similarity index 100% rename from src/styles/base.scss rename to src/styles/global.scss