Code Monkey home page Code Monkey logo

shopify-build's Introduction

documentation related to environment setup and deployments can be found here

Shopify Build Tool

This repository contains a fully capable Gulpfile.js intended for use with Shopify theme builds. It also includes the accompanying directory structure used alongside the build tool, as well as a number of blank or very basic .scss, .js, and .liquid files commonly used in a Shopify theme build.

Things this build tool includes and/or will do:

  • Build a proper directory structure for your theme to be uploaded
  • Compile, autoprefix, and minify your .scss to .css (strictly using libsass)
  • Concatenate and minify your JavaScript files
  • Compile, concatenate, autoprefix, and minify all your vendor JavaScript and .scss/.css into their own vendor.js/vendor.css files
  • Inline sourcemaps to both main.js and main.css to help with debugging
  • After initial build, will watch your theme files and preforming the necessary tasks on change
  • Optionally & automatically upload any changed file directly to a Shopify environment of your choosing

Installation

After cloning the repository and moving into its root, from the command line run npm install. After the installation completes, you'll have access to to all of the gulp tasks.

Tasks

Usage

gulp [TASK] [OPTIONS...]

Available tasks

  • clean clears out everything in the deploy/ directory
  • styles compiles, autoprefixes, minifies, attaches sourcemap, and renames main.scss manifest located in dev/styles to deploy/assets/main.css.liquid
  • scripts concatenates, minifies, attaches sourcemap, and renames every .js file located in dev/scripts to deploy/assets/scripts.js.liquid
  • vendor compiles, concatenates, autoprefixes, and minifies every .scss file located in vendor/styles and every .js file located in vendor/scripts into deploy/assets/vendor.css and deploy/assets/vendor.js
  • copy copies every file in dev/liquid into deploy/ carrying the same directory structure
  • build runs and completes clean before running copy styles scripts vendor and imagemin asynchronously --env [environment name], where [environment name] is the attribute inside of "./config.js that holds all the relavent data for the store you want to upload to (e.g. api key). If --env is entered, but no environment given, it defaults to "staging"

Commonly run tasks

  • gulp -cleans, rebuilds, and watches theme files without uploading to a Shopify store
  • gulp --env -cleans, rebuilds, watches theme files, and uploads to whatever the default environment has been set to in the Gulpfile.
  • gulp --env [environment name] -cleans, rebuilds, watches theme files, and uploads to [environment name] in config.json

Keep in mind that simply running gulp will fire off a number of those tasks in a specific order designed to make your development as easy as possible. Ideally you would only need to run gulp (or gulp --env [environment name]) once at the start of your project and then never again interact with the build tool while it takes care of chores for you in the background.

Submit a pull request or share if you have any additional ideas.

shopify-build's People

Contributors

tshamz avatar

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.