Git Product home page Git Product logo

example-ecommerce-snipcart-vue's Introduction

The Transglobal Candy Store

A frontend example in Vue.js and Nuxt.js for the Sanity.io e-commerce schema

๐Ÿ”— Read the blog post

Short animated preview of the app

Quickstart on local

# install dependencies
$ npm install

# serve with hot reload at localhost:3000
$ npm run dev

Tips:

  • Make sure you are running on http://localhost:3000. If not sanity and snipcart will fail due to CORS origins.
  • Vue.js requires a recent Node version so if it fails on startup you might need an upgrade.

Using your own sanity.io data

You're about five minutes away from running this example with your own data. You'll need to set up a Sanity studio for this so:

  • If you don't have Sanity CLI version 0.130.0 or later, install or upgrade it with npm install -g @sanity/cli
  • Initialize a new project with sanity init and select the e-commerce schema
  • sanity start will start your studio and let you start adding your products!
  • Go to sanity.json and locate your projectId and dataset

Head back to this project and in sanity.js change the projectId and dataset values to the ones you found above

Tips:

  • Remember to add CORS manage.sanity.io (ex. http://localhost:3000 to run locally)
  • You can sanity deploy your editor to share it with others

Install your own snipcart

Build production server or static project

# build for production and launch server
$ npm run build
$ npm start

# generate static project
$ npm run generate

If you want to host this on Netlify, as a static build, follow these steps while switching out the generate command above and changing the output directory from out to dist. Note: Nuxt is intended to run as a universal/isomorphic app and will make calls to the Sanity CDN.

The queries are by default limited to 100 items. This project is just an example, but it is possible to expand it with pagination or forever-scroll. To get more items, just add ex [0..1000] to the end of your query https://www.sanity.io/docs/data-store/query-cheat-sheet#slice-operations

For detailed explanations on how Nuxt.js work, checkout the Nuxt.js docs.

example-ecommerce-snipcart-vue's People

Contributors

bjoerge avatar dependabot[bot] avatar evenwestvang avatar kmelve avatar kristofferjs 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  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  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  avatar  avatar  avatar

Watchers

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

example-ecommerce-snipcart-vue's Issues

Error with command: npm run dev

ร— error C:........\example-ecommerce-snipcart-vue\sanity.js:1
SyntaxError: Error parsing C:............\example-ecommerce-snipcart-vue\node_modules@sanity\client\package.json: Unexpected token , in JSON at position 2445
at JSON.parse ()
at Object. (C:............\example-ecommerce-snipcart-vue\sanity.js:1)

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.