vfs.src([path.join(modulePath, 'dist', '_static', 'js', '**', '*.js'), path.join('!' + modulePath, 'dist', '_static', 'js', '**','*.min.js')]) .pipe(athenaMate.uglify(jsCompressConf).on('error', $.util.log)) .pipe($.rename(function (path) { path.basename += '.min'; })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static', 'js')))
vfs.src([path.join(modulePath, 'dist', '_static', '**', '*.js'), path.join('!' + modulePath, 'dist', '_static', '**', '*.min.js')]) .pipe(athenaMate.uglify(jsCompressConf).on('error', $.util.log)) .pipe($.rename(function (path) { path.basename += '.min'; })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static'))) .on('finish', function () { $.util.log($.util.colors.green('结束' + mod + '模块任务压缩JS文件!')); resolve(); }).on('error', function (err) { $.util.log($.util.colors.red(mod + '模块任务压缩JS文件失败!')); reject(err); });
streamArr.push( vfs.src(jsArr) .pipe(athenaMate.concatCore(pageName + '_all.js')) .pipe(athenaMate.uglify({ onComplete: function (savedInfo) { Util.generateStatistics(modulePath, 'optimize.js', savedInfo); } }).on('error', $.util.log)) .pipe(vfs.dest(path.join(modulePath, 'dist', 'output', 's'))) );
es.merge(streamArr) .on('finish', function () { vfs.src(combofileSHtmlList) .pipe($.if(useShtml, athenaMate.ftp(deployCssiParams))) .on('data', function () {}) .pipe($.util.noop()) .on('finish', function () { vfs.src(summaryPage, { base: path.join(appPath, '.temp', appConf.app) }) .pipe(athenaMate.ftp(_.assign(_.clone(deployParams), { remotePath: (argsRemotePath || deployOptions.remotePath) }))) .on('data', function () {}) .pipe($.util.noop()) .on('finish', function () { if (remoteName !== 'preview') { $.util.log($.util.colors.green('你可能需要发布上线这些文件:')); publishFiles.forEach(function (item) { console.log(' ' + $.util.colors.bgCyan(item)); }); console.log(); } console.log(' ' + $.util.colors.green('访问地址:' + 'http://' + deployOptions.domain + deployOptions.fdPath + appConf.app)); console.log(); resolve(publishFiles); }); }); });
vfs.src(htmlPathList, { base: path.join(modulePath, 'dist', 'output', 'tpl') }) .pipe(gulpSSH.dest(deployRemoteParams.remotePath)) .on('finish', function () { vfs.src(globPages, { base: path.join(modulePath, 'dist', 'output', 's') }) .pipe(athenaMate.publishFilterServer({ })) .pipe(gulpSSH.dest(deployRemoteParams.remotePath)) .on('finish', function () { vfs.src(summaryPage, { base: path.join(appPath, '.temp', appConf.app) }) .pipe(gulpSSH.dest(deployOptions.remotePath)) .on('finish', function () { if (gulpSSH) { gulpSSH.close();
es.merge(streamArr) .on('end', function () { vfs.src(combofileSHtmlList) .pipe($.if(useShtml, gulpSSH.dest(deployCssiParams.remotePath))) .on('finish', function () { vfs.src(summaryPage, { base: path.join(appPath, '.temp', appConf.app) }) .pipe(gulpSSH.dest((argsRemotePath || deployOptions.remotePath))) .on('finish', function () { if (gulpSSH) { gulpSSH.close(); } if (remoteName !== 'preview') { $.util.log($.util.colors.green('你可能需要发布上线这些文件:')); publishFiles.forEach(function (item) { console.log(' ' + $.util.colors.bgCyan(item)); }); console.log(); } console.log(' ' + $.util.colors.green('访问地址:' + 'http://' + deployOptions.domain + deployOptions.fdPath + appConf.app)); console.log(); resolve(publishFiles); }); }); });
sasslib : sasslib })) .on('data', function () {}) );
vfs.src(path.join(sassCacheFolder, '**', '*.css'), {base: sassCacheFolder}) .pipe(vfs.dest(path.join(modulePath, 'dist', '_'))) .on('finish', function () { vfs.src([path.join(modulePath, 'dist', '_', '**', '*.scss'), path.join(modulePath, 'dist', '_', '**', '*.sass')]) .on('finish', function() { $.util.log($.util.colors.green( '开始' + mod + '模块任务的sass')); }) .on('data', function () {}) .on('end', function() { vfs.src(path.join(modulePath, 'dist', '_', '**', '*.css')) .pipe(through2.obj(function (file, encoding, cb) { // 只有统计目录下有同名的scss文件才会被拷贝 })) .pipe(vfs.dest(sassCacheFolder)) .on('finish', function () { $.util.log($.util.colors.green( '完成' + mod + '模块任务的sass' )); resolve(); }) .on('error', function (err) { if (!isServe) { throw new Error(mod + '模块的sass文件编译失败!') }); }) .on('error', function(err) { $.util.log($.util.colors.red( mod + '模块的sass文件编译失败!' )); if (!isServe) {
vfs.src(htmlPathList, { base: path.join(modulePath, 'dist', 'output', 'tpl') }) .pipe(athenaMate.ftp(deployRemoteParams)) .on('data', function () {}) .pipe($.util.noop()) .on('finish', function () { vfs.src(globPages, { base: path.join(modulePath, 'dist', 'output', 's') }) .pipe(athenaMate.publishFilterServer({ })) .pipe(athenaMate.ftp(deployRemoteParams)) .on('data', function () {}) .pipe($.util.noop()) .on('finish', function () { vfs.src(summaryPage, { base: path.join(appPath, '.temp', appConf.app) }) .pipe(athenaMate.ftp(_.assign(_.clone(deployParams), { remotePath: deployOptions.remotePath }))) .on('data', function () {}) .pipe($.util.noop()) .on('finish', function () { if (remoteName !== 'preview') { $.util.log($.util.colors.green('你可能需要发布上线这些文件:'));
it('Image `width` -> should be able to get `width` properties.', function(done) { vfs.src('./test/src/css/style.css') .pipe(postcss([lazyimagecss({ imagePath: ['../img','../slice'] })])) .pipe(through2.obj(function(file, enc, cb){ content = file.contents.toString(); content.match(/width/g).length.should.equal(14); cb(); })) .on('data', noop) .on('end', done); });
gulp.task('transpile', function() { return gulp.src("./src/bin/*.js") .pipe(plumber()) .pipe(webpack(webpackConfig)) .pipe(uglify().on('error', console.log)) .pipe(gulp.dest("./dist/bin")) })
it('`background-size` value -> should be able to get correct height value.', function(done) { vfs.src('./test/src/css/style.css') .pipe(postcss([lazyimagecss({ imagePath: ['../img','../slice'] })])) .pipe(through2.obj(function(file, enc, cb){ content = file.contents.toString(); content.indexOf('background-size: 14px 14px').should.be.above(0); cb(); })) .on('data', noop) .on('end', done); });
vfs.src([path.join(modulePath, 'dist', '_static', '**', '*.js'), path.join('!' + modulePath, 'dist', '_static', '**', '*.min.js')]) .pipe(athenaMate.uglify(jsCompressConf).on('error', $.util.log)) .pipe($.rename(function (path) { path.basename += '.min'; })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static')))
sasslib : sasslib })) .on('data', function () {}) );
it('Image `height` -> should be able to get `height` properties.', function(done) { vfs.src('./test/src/css/style.css') .pipe(postcss([lazyimagecss({ imagePath: ['../img','../slice'] })])) .pipe(through2.obj(function(file, enc, cb){ content = file.contents.toString(); content.match(/height/g).length.should.equal(12); cb(); })) .on('data', noop) .on('end', done); });