Skip to content

Instantly share code, notes, and snippets.

View IliasHad's full-sized avatar
🏠
Working from home

Ilias Haddad IliasHad

🏠
Working from home
View GitHub Profile
const { createRemoteFileNode } = require("gatsby-source-filesystem")
exports.onCreateNode = async ({
node,
actions,
store,
cache,
createNodeId,
}) => {
const { createNode } = actions
if (node.internal.type === "googleSheetSheet1Row") {
{
resolve: 'gatsby-source-google-sheets',
options: {
spreadsheetId: 'get this from the sheet url', worksheetTitle: 'ie the name in the worksheet tab', credentials: require('./secret.json')
}
}
@IliasHad
IliasHad / product.js
Created April 21, 2020 22:45
How to Gatsby Image in Strapi Multiple Image
query {
strapiProducts(slug: { eq: ""}) {
title
description
images {
localFile {
childImageSharp {
fixed(height: 100, width: 100, quality: 100) {
...GatsbyImageSharpFixed
Accepts:
- image: {Object} Image object
Usage:
In your liquid template file, copy the following line
<div class="lazyload" data-bgset="{% include 'responsive-bg-image', image: article.image %}"></div>
Accepts:
- max_width: {Number} Max width of the image container
- max_height: {Number} Max height of the image container
- image: {Object} Image object
- image_class: {String} class name of the <img />
- image_attributes: {String} additional HTML attributes of the <img />
- wrapper_class: {String} class name of the <div> wrapper
- wrapper_attributes: {String} additional HTML attributes of the <div> wrapper
Usage:
@IliasHad
IliasHad / gist:11813ca996fec6a6650af89b378cb99d
Last active June 28, 2019 15:44
Preload Web Font in shopify
<style>
@font-face {
font-family: 'Montserrat'; Replace Montserrat with your web font name
font-style: normal;
font-weight: 400; Replace it with your font weight and you'll find it google web font helper
font-display: swap; Don't Change it
src: local('Montserrat'), local('Montserrat-Regular'), Replace Montserrat with your web font name
url(https://cdn.shopify.com/s/files/1/0077/8295/7119/files/montserrat-v12-latin-regular.woff2) format('woff2'), Replace Link with web font file url specific for this font weight and with woff2 file type ( admin > settings > files )
url(https://cdn.shopify.com/s/files/1/0077/8295/7119/files/montserrat-v12-latin-regular.woff) format('woff'); Replace Link with web font file url specific for this font weight and with woff file type ( admin > settings > files )
}
<div class="lazyload" data-bgset="{% include 'bgset', image: article.image %}"></div>
{% include 'responsive-image'
with image: featured_image,
image_class: "css-class",
wrapper_class: "wrapper-css-class",
max_width: 700,
max_height: 800 %}
<! - [if (gt IE 9)|!(IE)]><! →<script src="{{ 'app.js' | asset_url }}" defer="defer" async></script><! - <![endif] →
 <! - [if lte IE 9]><script src="{{ 'app.js' | asset_url }}"></script><![endif] →