0.0.3 • Published 4 years ago

@k2omni/gulp-shopify-script-preprocessor v0.0.3

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
4 years ago

gulp-shopify-script-preprocessor

Getting Started

  1. Add the K2O registry into the .npmrc in your package
@k2o:registry=http://159.65.102.149:8081/repository/npm-private
  1. Install dependency:
$ npm install --save-dev @k2o/gulp-shopify-script-preprocessor
  1. In your gulpfile.js:
const shopifyScriptPreprocessor = require('@k2o/gulp-shopify-script-preprocessor');
const concat = require('gulp-concat');

gulp.task('js', function() {
  gulp.src(['app/assets/js/main.js'])
      .pipe(shopifyScriptPreprocessor())
      .pipe(concat())
      .pipe(gulp.dest('dest/assets/js/'));
});
  1. In your js files:
/*
 * @shopify {% if template == 'product' %} <%= script %> {% endif %}
 */

let a = (function () {
    return (a, b) => a + b;
})()
console.log(a(1, 2))
0.0.3

4 years ago