• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

tmslnz/gulp-shopify-theme: Shopify theme synchronisation during development

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

tmslnz/gulp-shopify-theme

开源软件地址(OpenSource Url):

https://github.com/tmslnz/gulp-shopify-theme

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-shopify-theme

npm

Gulp Shopify Theme

Gulp.js plugin for Shopify theme development.

Highlights:

  • Asynchronous theme assets uploads.
  • Retry on error.
  • Bulk theme files deletion.
  • Multiple instance support.

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 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

  • 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.

    Options are:

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

    batchMode will force stream() to return the Gulp stream immediately. In this mode you can subscribe to done and error to be notified when all tasks have ended.

    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.

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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
spmjs/gulp-spm: gulp plugin for cmd transport发布时间:2022-06-21
下一篇:
jaredeiseman/gulp-scaffold发布时间:2022-06-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap