⚠️ Shopify Theme Scripts is currently an Alpha release. You should expect breaking changes between updates and more bugs than a finalized release. We believe that by getting Theme Scripts in the hands of developer communtiy as soon as possible, we can gather critical feedback to make it an even bigger success.
Theme Scripts is a collection of handy utility libraries which help theme developers with problems unique to Shopify Themes.
The goal of each theme script is to be remain uncoupled from a particular UI. Typically, theme scripts should be used alongside a customized solution for a particular theme. For example, @shopify/theme-cart
is a great way to interact with the Shopify Cart API and add and remove items, but it does not enforce a particular pattern to display or update the visual state of the cart.
Theme Scripts can be used in any theme project. To take advantage of semantic versioning and easy updates, we recommend using NPM or Yarn to include them in your project. For example, to use @shopify/theme-cart
in your project:
yarn add @shopify/theme-cart
and then import the functions you wish to use through ES6 imports:
import {updateNote} from '@shopify/theme-cart`;
Explore each of packages for documentation on how to use each Theme Script.
Each Theme Script is transpiled to two versions:
- A CommonJS version which can be imported using
require()
syntax. - A ES Module version which can be imported using
import
syntax.
Webpack detects the "modules"
key when using importing via import
so the correct version should automatically be imported for you.
For help on setting up the repository locally, building, testing, and contributing please see CONTRIBUTING.md.
All developers who wish to contribute through code or issues, take a look at the Code of Conduct.
Copyright (c) 2018 Shopify. See LICENSE for further details.