tmslnz / gulp-shopify-theme

Shopify theme synchronisation during development
Apache License 2.0
24 stars 6 forks source link
gulp gulpjs liquid liquid-templating-engine shopify
gulp-shopify-theme

npm

Gulp Shopify Theme

Gulp.js plugin for Shopify theme development.

Highlights:

Install

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

Features

Usage

A 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);
});

gulp.task( 'watch', function () {
    //
    // …watch and compile tasks…
    //

    shopifytheme.on('done', browserSync.reload());
});

Methods

Options

For now it's just API configuration.

Events

The plugin instance emits two events done and error at the end of a sync task queue.

On done the event handler receives the list of files that have successfully synced.
On error the handler is passed whatever error was thrown in the process.