UNPKG

motion

Version:

motion - moving development forward

45 lines (32 loc) 1.75 kB
exports.__esModule = true; var styles = _asyncToGenerator(function* () { var where = { src: _opts2['default']('styleDir'), glob: ['*', '**/*'], out: _opts2['default']('styleOutDir') }; yield _libFns.mkdir(where.out); return gulpStyles(where); } // todo this is re-running every build --watch change, use $.watch ); exports.styles = styles; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(null, 'next'); var callThrow = step.bind(null, 'throw'); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; } var _libHelpers = require('./lib/helpers'); var _opts = require('../opts'); var _opts2 = _interopRequireDefault(_opts); var _libFns = require('../lib/fns'); function gulpStyles(_ref) { var src = _ref.src; var glob = _ref.glob; var out = _ref.out; return new Promise(function (resolve, reject) { _libHelpers.gulp.src(glob, { cwd: src }).pipe(_libHelpers.$.plumber()).pipe(_libHelpers.$['if'](_opts2['default']('watch'), _libHelpers.$.multipipe(_libHelpers.$.cached('styles'), _libHelpers.$.remember('styles')))).pipe(_libHelpers.$.concat(_opts2['default']('styleOutName'))).pipe(_libHelpers.gulp.dest(out)).on('end', function () { _libFns.log.gulp('finished styles'); resolve(); }).on('error', reject); // resolve right away for watch if (_opts2['default']('watch')) resolve(); }); }