Git Product home page Git Product logo

gulp-shopify-theme's Introduction

gulp-shopify-theme

npm

Gulp Shopify Theme

Shopify theme development support for Gulp.js. Asynchronous theme assets uploads, retry-on-error, remote purge.

Install

$ npm install --save-dev gulp-shopify-theme

Features

  • Queue Shopify API calls respecting the 40-call/burst / 2 call/sec limits
  • Support idiomatic Gulp.js workflow: .pipe(shopifytheme.stream( options ))
  • Support purging all theme files on Shopify (for cleanup and reupload)
  • Multiple instance support. Sync multiple themes via a single gulpfile.js
  • Uses the excellent Microapps' shopify-api-node as the API wrapper

Usage

A full working example can be found here: gist.github.com/tmslnz/1d025baaa…

var shopifytheme = require('gulp-shopify-theme').create();
var shopifyconfig = {
    "api_key": "8a1a2001d06ff…",
    "password": "51f8c8de49ee28…",
    "shared_secret": "51f8c8de49ee51…",
    "shop_name": "yourshopname…",
    "theme_id": "12345678…"
}

gulp.task( 'copy', ['shopify-theme-init'], function () {
    return gulp.src( [ 'src/{layout,config,snippets,templates,locales}/**/*.*' ] )
        .pipe( shopifytheme.stream() );
});

gulp.task( 'shopify-theme-init', function () {
    shopifytheme.init(shopifyconfig);
});

Methods

  • shopifytheme.create( options )

    Returns a new instance. The instance will do nothing until .init( options ) is called on it.

  • shopifytheme.init( options )

    Initialises an instance with options. The plugin will wait for, and queue, new files as they come through.

  • shopifytheme.stream( options )

    Use this to stream any theme file to the plugin.

     gulp.src( [ 'src/js/*.js' ] )
         .pipe( shopifytheme.stream( {theme_id: 12345} ) )
         .pipe( gulp.dest( 'dist' ) )

    Passing theme_id is optional if you have already passed it to the instance's configuration on init(). However if used it will override the pre-exisiting theme_id. If no theme_id is present an error is thrown.

  • shopifytheme.purge()

    This will delete all theme files from Shopify. Equivalent to going to the Shopify Admin and deleting each file by hand (eww!).
    Use with caution, of course.

    .purge() honours a blacklist of _un_deletable files (e.g. layout/theme.liquid)

Options

For now it's just API configuration.

  • api_key
  • password
  • shared_secret
  • shop_name
  • theme_id

gulp-shopify-theme's People

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.