GithubHelp home page GithubHelp logo

builderio / gatsby-builder-shopify Goto Github PK

View Code? Open in Web Editor NEW
32.0 9.0 15.0 641 KB

A starter for Gatsby + Shopify + Builder.io

Home Page: https://builder-shopify-starter.firebaseapp.com/

License: MIT License

Shell 0.80% JavaScript 5.88% TypeScript 93.32%
builder shopify gatsby tsx theme-ui headless ecommerce

gatsby-builder-shopify's Introduction

Builder.io + Shopify + Gatsby Starter

✔️ All the power of going headless, speed of Gatsby and, the customizability of Builder.io

✔️ Typescript + Theme-UI

✔️ gatsby-theme-shopify-manager The easiest way to build a shopify store on gatsby.

✔️ Analytics, A/B testing, product augmentation, and heatmaps out of the box.

Editor example

Get Started

Install the Builder.io cli

npm install @builder.io/cli -g

Clone this repo

using git

git clone https://github.com/BuilderIO/gatsby-builder-shopify

Generate your Builder.io space

Signup for Builder.io, then go to your organization settings page, create a private key and copy it, then create your space and give it a name

cd gatsby-builder-shopify
builder create -k [private-key] -n [space-name] -d

This command when done it'll print your new space's public api key, copy it and add as the value for GATSBY_BUILDER_PUBLIC_KEY into the .env files (.env.production and .env.development)

GATBY_BUILDER_PUBLIC_KEY=...

Connect Shopify

Now you have a space clone matching the spec defined in this repo, you'll need to connect it to your shopify store.

Create a private app in your Shpoify store and generate both admin api keys and storefront API token.

Access your newly created space, by selecting it from the list of spaces in your organization, then from space settings, configure the @builder.io/plugin-shopify with the required details: admin api key / password, store domain, please feel free to ignore the import your products/collections step since it's not needed for this starter.

Add your storefront api token to the .env files (.env.all)

GATSBY_SHOPIFY_ACCESS_TOKEN=...
GATSBY_SHOP_NAME=...

Install dependencies

yarn

Run the dev server

yarn develop

It'll start a dev server at http://localhost:8000

Deploy

Deploy to Netlify For continuous deployment from netlify <> Builder.io :

  • Create a build hook in netlify
  • Add the build hook from last step to Builder.io global webhooks in your new space settings.

🧐 What's inside?

This starter demonstrates:

  • creating product pages in builder.io for easier a/b testing and cusotm targeting.
  • shows how to pass context with the editor for binding components to dynamic state object for easier templating, for things like product pages, collection pages.
  • shows how can you customize and augment your data, for example a specific product in shopify you want to override it's description for an a/b test, that's as simple as setting a default binding, and allowing users to break the binding for a specific product handle.

See:

Using your custom components in the editor

👉Tip: want to limit page building to only your components? Try components only mode

Register a component

import { Builder } from '@builder.io/react';

class SimpleText extends React.Component {
  render() {
    return <h1>{this.props.text}</h1>;
  }
}

Builder.registerComponent(SimpleText, {
  name: 'Simple Text',
  inputs: [{ name: 'text', type: 'string' }],
});

Then import it in the template entry point

import './components/simple-text';
// ...

See:

Mixed Content errors when hosting on insecure http

Our editor uses the preview URL you supply for live editing. Because the editor is on https, the preview might not work correctly if your development setup uses http. To fix this, change your development set up to serve using https. Or, as a workaround, on Chrome you can allow insecure content on localhost, by toggling the insecure content option here chrome://settings/content/siteDetails?site=http%3A%2F%2Flocalhost%3A9009

Prerequisites

Available scripts

build

Build the static files into the public folder

Usage

$ yarn build

develop or start

Runs the clean script and starts the gatsby develop server using the command gatsby develop.

Usage

yarn develop

format

Formats code and docs according to our style guidelines using prettier

CONTRIBUTING

Contributions are always welcome, no matter how large or small.

Learn more

gatsby-builder-shopify's People

Contributors

maddyzablocki avatar steve8708 avatar teleaziz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-builder-shopify's Issues

Error on fresh clone and npm run develop

Error log:

Missing onError handler for invocation 'building-schema', error was 'Invariant Violation: Encountered an error trying to infer a GraphQL type for: `localFile___NODE`. There is no corresponding node with the `id` field matching: "b4cb14c8-d38a-5ffa-a2a6-a4d79f19825c,54e5bdf3-3bcf-57da-8257-81f60f09d44e,6b4fba2c-6c55-5eaa-8f6c-ce02a16870a9,f8b49cab-34b7-5a91-af8d-717590f2ed69,0221ca07-6387-573a-bec1-93746353014b,89c4a06b-0dad-570f-9250-5930be0d41fb,449025d8-20a4-5dd4-bce5-f753875aca79,fe49e796-968e-5592-94d8-4a7357b7bb7b,617bbd8c-578d-58fb-ace5-cb7107b7f194,c094a759-aa41-5da4-b0a1-f500bc918524,5e19d985-085c-5ed3-97e6-309c5b93094e,6037d1b3-f12a-570a-b100-a1d8e54d58dc,aae39281-8820-58f2-816a-567a44146c9c,534ff149-d06f-59ed-9f46-b7120dd20fcb,ba6cfbb5-bf43-5cdf-967e-8ea5fd9eddbe,143bea72-e99f-513e-83b1-c97668020a43,c6258a21-d414-5d87-a3cf-b319712321fa,98a415e6-809f-5379-bac5-a396c04aa649,0adf22f3-2d23-51d1-a709-62a72f1962f4,451d709a-0af8-5bda-b68e-4da965fa8006,c30cfeb0-2969-5ffe-9c30-9eada3556b73,6c30f6af-fcd2-5365-b4e7-bca5a71ab525,40049372-1e41-5d82-a542-ae82315d5a88,ea6d73ab-cb34-5929-9267-0644fcc7f5a4,6e335568-e3a6-5f18-b500-8e661b5028a7,a10d03e8-05cb-5eaa-9d73-465a2f41b7bf,40c6f7c9-54b3-519c-abd9-875f99d3d103,e5d70b77-a8d0-5d42-bc22-13711e5e922e,6d42ec87-b55b-5d8a-94c5-ea6416e26007,a942eaba-754a-54dc-96a7-d2aa48239ece,dea2c9bb-ba75-5869-80db-60f64e023695,ea30ba9f-ab27-5f04-8088-09fcf2f3638e,880c8170-6df4-556e-b388-8596182d15c5,39d3d2b1-887a-537c-adbd-67c826d1313e".'.

Steps to reproduce:

  1. Clone this repo
  2. npm install
  3. npm run develop

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.