UNPKG

motion

Version:

motion - moving development forward

73 lines (54 loc) 2.43 kB
exports.__esModule = true; var assets = _asyncToGenerator(function* () { try { yield Promise.all([assetsApp(), assetsStatics()]); } catch (e) { _libFns.handleError(e); } } // app images, fonts, etc ); exports.assets = assets; // .motion/static var assetsStatics = _asyncToGenerator(function* () { var statics = { dir: _libFns.p(_opts2['default']('motionDir'), 'static'), glob: ['*', '**/*', '!.motion{,/**}'], out: _libFns.p(_opts2['default']('buildDir'), '_', 'static') }; yield _libFns.mkdir(statics.out); var stream = _libHelpers.gulp.src(statics.glob, { cwd: statics.dir }); if (_opts2['default']('watch')) stream = stream.pipe(_libHelpers.$.watch(statics.glob, { readDelay: 1 })); return new Promise(function (resolve, reject) { stream.pipe(_libHelpers.$.plumber()) // .pipe($.log(out.goodFile('⇢'))) // .pipe($.filterEmptyDirs) .pipe(_libHelpers.gulp.dest(statics.out)).on('end', function () { _libFns.log.gulp('finished statics'); resolve(); }).on('error', reject); }); }); 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 assetsApp() { var assets = { glob: ['*', '**/*', '!**/*.js',, '!**/*.js.map', '!.motion{,/**}'], out: _opts2['default']('buildDir') }; var stream = _libHelpers.gulp.src(assets.glob); if (_opts2['default']('watch')) stream = stream.pipe(_libHelpers.$.watch(assets.glob, { readDelay: 1 })); return new Promise(function (resolve, reject) { stream.pipe(_libHelpers.$.plumber()) // .pipe($.log(out.goodFile('⇢'))) // .pipe($.filterEmptyDirs) .pipe(_libHelpers.gulp.dest(assets.out)).on('end', function () { _libFns.log.gulp('finished assets'); resolve(); }).on('error', reject); }); }