Giter Site home page Giter Site logo

hatch's Introduction

Hatch

Hatch is a minimal tool to help you build Shopify Online Store 2.0 themes using the (Shopify CLI)[https://github.com/shopify/shopify-cli]. The focus of the build tools is to use the most lightweight, minimal tools for processing JavaScript and CSS file for the use in themes.

The theme principals and concepts are following Shopify's Dawn theme with individual CSS and JavaScript files associated with each section.

Hatch is currently a work in progress and more of a working concept that we are using for our new Online Store 2.0 themes.

Tools

Hatch uses the /src directory for theme development introducing new /styles and /scripts directories for processing CSS (PostCSS) files and JavaScript. When running yarn dev a new /dist directory will be created where all files will be watched and copied into the directory, PostCSS will run to process and copy CSS files into /dist/assets, and Rollup.js will bundle and transpile Javascript files into /dist/assets.

(PostCSS)[https://github.com/postcss/postcss] and (Tailwindcss)[https://github.com/tailwindlabs/tailwindcss] JIT compiler is used for creating lean CSS files based on classes used throughout the JavaScript and Liquid files. Configurations in postcss.config.js and taiwind.config.js

(Rollup.js)[https://github.com/rollup/rollup] is used to copy files, transpile JavaScript and bundle modules. Hatch uses the same evergreen, modern browser approach as Dawn to focus on widely supported ES6 JavaScript rather than adding extra bloat to support older browsers. Configuration in rollup.config.js

JavaScript files

/src/scripts/theme.js is the primary JavaScript file intended to be used in Layouts/theme.liquid. Each of the sections that require a JavaScript file will be located in /src/scripts/[section-name].js.

CSS files

/src/scripts/theme.css is the primary CSS file intended to be used in Layouts/theme.liquid. Each of the sections that require a CSS file will be located in /src/scripts/[section-name].css.

Caveats

Currently adding a new .js or .css file for sections src/{scripts,styles}/sections you need to restart yarn dev to include the new files in the build tools.

Usage

Installation

# yarn
yarn install

Development

# yarn
yarn dev
  1. Cleans up and creates the /dist directory
  2. Runs Rollup.js, watches for file changes, processes JavaScript files and copies everything into /src
  3. Runs Postcss and Tailwindcss JIT to create just-in-time compiled CSS files in /src/assets
  4. Runs Shopify CLI shopify theme serve in the /dist folder

Build

# yarn
yarn build
  1. Runs Rollup.js, processes JavaScript files and copies everything into /src
  2. Runs Postcss and Tailwindcss to create lean CSS files in /src/assets

Deploy

# yarn
yarn deploy
  1. Builds the theme (see above)
  2. Runs Shopify CLI shopify theme push --development to push to a development unpublished theme

Package

# yarn
yarn package
  1. Builds the theme (see above)
  2. Runs Shopify CLI shopify theme package to create a versioned .zip file for the theme
  3. Copies the versioned theme .zip file to /build

hatch's People

Contributors

jonathanmoore avatar

Stargazers

Tineyi avatar Mario Rader avatar  avatar Sohey avatar Andrei Babor avatar  avatar Rogelio Alatorre avatar Thomas Kelly avatar  avatar Patrick avatar Tyler avatar jarid avatar Hani S avatar Paul avatar Liam Griffin avatar Dan Sack avatar Remy Wang avatar Harold AO avatar Cal Wilson avatar Kelsey J Cooper avatar Taylor Page avatar Leigh Barnes avatar

Watchers

 avatar Liam Griffin avatar  avatar

hatch's Issues

filex completely disappear from /dist

I have an urgent and strange issue with a site build using this tool.

Running yarn dev seems to completely erase all files from the /dist folder and present a bug in the console:

`> [email protected] build:rollup
> NODE_ENV=production rollup -c


src/scripts/theme.js, src/scripts/sections/*.js โ†’ dist...
[!] TypeError: [conf.input].flat is not a function
TypeError: [conf.input].flat is not a function
    at Object.options (/Users/madebyrichard/Dropbox/Work/2021-clients/Emmy London/emmy-london/node_modules/rollup-plugin-multi-input/dist/plugin.js:137:15)
    at /Users/madebyrichard/Dropbox/Work/2021-clients/Emmy London/emmy-london/node_modules/rollup/dist/shared/rollup.js:20978:43

ERROR: "build:rollup" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Would be great to know what is causing this issue. thanks

Thank you!

Hey there,

Just wanted to thank you for this awesome setup. Was thinking of doing something similar until I found this repo. It's been a real joy to work with. Let me know if there's any issues/features I can help with!

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.