through.obj((file, enc, next) => { if (file.isNull() || file.isDirectory()) { next(null, file); return; } if (!some(file.extname, file.history[0])) { next(null, file); return; } file.$ = cheerio.load(file.contents.toString(), options); next(null, file); })
through.obj(function(file, enc, next) { if (file.isNull() || file.isDirectory()) { next(null, file); return; } if (file.extname !== '.md' && path.extname(file.history[0]) !== '.md') { next(null, file); return; } try { let md = new Remarkable(opts); file.contents = Buffer.from(md.render(file.contents.toString())); file.extname = '.html'; } catch (err) { this.emit('error', new PluginError('remarkable', err, { fileName: file.path })); return; } next(null, file); })
through.obj(function(file, enc, next) { if (file.isNull() || file.isDirectory()) { next(null, file); return; } if (file.extname !== '.md' && path.extname(file.history[0]) !== '.md') { next(null, file); return; } try { let str = file.contents.toString(); str = str.replace(/(\{{2,4})([^}]+)(\}{2,4})/g, (m, open, inner, close) => { return open + unescape(inner) + close; }); file.contents = Buffer.from(str); } catch (err) { this.emit('error', new PluginError('unescape', err, { fileName: file.path })); return; } next(null, file); })
vfs.src(path.join(modulePath, 'dist', '_', '**', 'images', '**')) .pipe(through2.obj(function(file, enc, cb){ if (!file.isDirectory()) { var fp = file.path; var fb = file.base; var fbaseAfter = fp.replace(fb, ''); var fbaseDist = fb.replace(path.join(modulePath, 'dist'), ''); if (fbaseDist.indexOf('images') <= 0 && fbaseAfter.indexOf('images') >= 0) { fbaseAfter = fbaseAfter.substr(0, fbaseAfter.indexOf('images') + 7); file.base = path.join(file.base, fbaseAfter); } this.push(file); } cb(); })) .pipe(vfs.dest(path.join(modulePath, 'dist', '_static', 'images'))) .on('end', function () { resolve(); });
through2.obj(function (file, encoding, callback) { if (file.isNull() || file.isStream()) { return callback(null, file); } if (file.isBuffer()) { var imports = Util.sassImports(file.contents); var importsPaths = generateSassPath(path.join(opts.cwd, '*', 'dist', '_'), imports); sassGraphJson[file.path] = sassGraphJson[file.path] || {}; sassGraphJson[file.path].imported = importsPaths; this.push(file); callback(); } }, function (callback) { fs.writeFileSync(sassGraphPath, JSON.stringify(sassGraphJson, null, 2)); callback(); })
streamArr.push( vfs.src(publishFoldersInfo[key].concat(htmlFiles), { base: key }) .pipe($.if(isShowAll ? true : false, through2.obj((function (moduleName) { return function (file, encoding, cb) { if (file.isDirectory()) { remote: remoteName })) .pipe(through2.obj((function (moduleName) { return function (file, encoding, cb) { if (file.isDirectory()) {
through.obj(function (file, encoding, callback) { ctx.ready(function () { ssh.sftp(function (err, sftp) { if (err) return callback(new gutil.PluginError(packageName, err)) options.autoClose = true var write = sftp.createWriteStream(filePath, options) write .on('error', function (error) { err = error }) .on('finish', function () { sftp.end() if (err) callback(err) else callback(null, file) }) if (file.isStream()) file.pipe(write) else if (file.isBuffer()) write.end(file.contents); else { err = new gutil.PluginError(packageName, 'file error!') write.end() } }) }) })
mapJson: mapJson })) .pipe($.if(jsProcessorConf.type === 'nerv', through2.obj(function (file, enc, cb) { if (file.isNull() || file.isStream()) { return cb(null, file)
through.obj(function (file, encoding, callback) { if (file.isNull()) { gutil.log('"' + gutil.colors.cyan(file.path) + '" has no content. Skipping.') return callback() } getSftp(function (err, sftp) { if (err) return end(err, callback) var outPath = path.join(destDir, file.path.replace(file.base, '')).replace(/\\/g, '/') gutil.log('Preparing to write "' + gutil.colors.cyan(outPath) + '"') internalMkDirs(sftp, outPath, function (err) { if (err) return end(err, callback) gutil.log('Writing \'' + gutil.colors.cyan(outPath) + '\'') file.pipe(sftp.createWriteStream(outPath, options)) .on('error', done) .on('finish', done) function done (err) { if (err) return end(err, callback) gutil.log('Finished writing \'' + gutil.colors.cyan(outPath) + '\'') callback() } }) }) }, function (callback) { end(null, callback) })
})) .pipe(vfs.dest(path.join(modulePath, 'dist', 'output'))) .pipe(through2.obj(function (file, encoding, cb) { if (file.isNull() || file.isStream()) { return cb(null);
streamArr.push( vfs.src(publishFoldersInfo[key].concat(htmlFiles), { base: key }) .pipe($.if(isShowAll ? true : false, through2.obj((function (moduleName) { return function (file, encoding, cb) { if (file.isDirectory()) { remote: remoteName })) .pipe(through2.obj((function (moduleName) { return function (file, encoding, cb) { if (file.isDirectory()) {
streamArr.push( vfs.src(publishFoldersInfo[key].concat(htmlFiles), { base: key }) .pipe($.if(isShowAll ? true : false, through2.obj((function (moduleName) { return function (file, encoding, cb) { if (file.isDirectory()) { remote: remoteName })) .pipe(through2.obj((function (moduleName) { return function (file, encoding, cb) { if (file.isDirectory()) {
through.obj((file, enc, next) => { if (file.isNull() || file.isDirectory()) { next(null, file); return; } if (!some(file.extname, file.history[0])) { next(null, file); return; } file.$ = cheerio.load(file.contents.toString(), options); next(null, file); })
through.obj(function(file, enc, next) { if (file.isNull() || file.isDirectory()) { next(null, file); return; } if (file.extname !== '.md' && path.extname(file.history[0]) !== '.md') { next(null, file); return; } try { let md = new Remarkable(opts); file.contents = Buffer.from(md.render(file.contents.toString())); file.extname = '.html'; } catch (err) { this.emit('error', new PluginError('remarkable', err, { fileName: file.path })); return; } next(null, file); })
through.obj(function(file, enc, next) { if (file.isNull() || file.isDirectory()) { next(null, file); return; } if (file.extname !== '.md' && path.extname(file.history[0]) !== '.md') { next(null, file); return; } try { let str = file.contents.toString(); str = str.replace(/(\{{2,4})([^}]+)(\}{2,4})/g, (m, open, inner, close) => { return open + unescape(inner) + close; }); file.contents = Buffer.from(str); } catch (err) { this.emit('error', new PluginError('unescape', err, { fileName: file.path })); return; } next(null, file); })