Giter Site home page Giter Site logo

javigong / shopify-theme Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 395 KB

Creating a Shopify theme for an Online Store 2.0 (JSON Templates) using Shopify CLI, Liquid, & TailwindCSS

CSS 99.20% JavaScript 0.01% Liquid 0.80%
shopify-cli shopify-theme liquid-templating-engine tailwindcss

shopify-theme's Introduction

How To Create a Shopify Theme

Creating a Shopify theme for an Online Store 2.0 (JSON Templates) using Shopify CLI, Liquid, & TailwindCSS.

Initial Theme Setup

  • Create a basic theme structure:

    shopify theme init ThemeName --clone-url RepositoryThemeUrl

  • Login Shopify Store:

    shopify login --store UrlOfShopifyStoreAdmin

  • Select partner organization

  • Update/Sync theme to your development store

    shopify theme serve

Tailwind CSS 2.2.7 setup

  • Check if you are logged in

    shopify whoami

  • Update/Sync theme to your development store

    shopify theme serve

  • Initialize npm package manager

    npm init -y

  • Install Tailwind CSS

    npm install -D tailwindcss postcss autoprefixer

  • Create a new postcss.config.js file adding the following code

    module.exports = {
      plugins: {
        tailwindcss: {},
        autoprefixer: {},
      },
    };
  • Initialize tailwind.config.js

npx tailwindcss init

  • Create new folder src

  • Create new file src/tailwind.css injecting the following tailwind features

@tailwind base;
@tailwind components;
@tailwind utilities;
  • Delete /assets/application.css.liquid file

  • Setup the Tailwind input and output css files npx tailwindcss -i ./src/tailwind.css -o ./assets/application.css

  • Edit layout/theme.liquid file adding this code to the header

{{ content_for_header }}
    <!-- Header hook for plugins -->
    {{ 'application.css' | asset_url | stylesheet_tag }}
    <script src="{{ 'application.js' | asset_url }}" async></script>

Tailwind CSS 3.0 setup

  • Check if you are logged in

    shopify whoami

  • Update/Sync theme to your development store

    shopify theme serve

  • Initialize npm package manager

    npm init -y

  • Install Tailwind CSS

    npm install -D tailwindcss postcss autoprefixer

  • Create a new postcss.config.js file adding the following code

    module.exports = {
      plugins: {
        tailwindcss: {},
        autoprefixer: {},
      },
    };
  • Initialize tailwind.config.js

npx tailwindcss init

  • Add the following code to tailwind.config.js
module.exports = {
  content: [
    "./assets/*.liquid",
    "./layout/*.liquid",
    "./sections/*.liquid",
    "./snippets/*.liquid",
    "./templates/*.liquid",
    "./templates/**/*.liquid",
    // you can also directly select all the liquid and json files
    // "./**/*.{liquid,json}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};
  • Create new folder src

  • Create new file src/tailwind.css injecting the following tailwind utility classes

@tailwind base;
@tailwind components;
@tailwind utilities;
  • Delete /assets/application.css.liquid file

  • Setup the Tailwind input and output css files with the utility classes with the watch flag npx tailwindcss -i ./src/tailwind.css -o ./assets/application.css --watch

  • Edit layout/theme.liquid file adding this code to the header

{{ content_for_header }}
    <!-- Header hook for plugins -->
    {{ 'application.css' | asset_url | stylesheet_tag }}
    <script src="{{ 'application.js' | asset_url }}" async></script>

JSON Templates

https://shopify.dev/themes/architecture/templates/json-templates

shopify-theme's People

Contributors

javigong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

geopixar

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.