Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('style-sass', function() {
// gulp.src('style/sass/index.scss')
// .pipe(plugins.sass())
// .pipe(plugins.autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
// .pipe(plugins.rename({
// suffix: '.min'
// }))
// .pipe(plugins.minifyCss())
// .pipe(gulp.dest('style/css'))
// .pipe(notify({
// message: 'Styles task complete'
// }));
var combined = combiner.obj([
gulp.src('style/sass/index.scss'),
plugins.sass(),
plugins.rename({
suffix: '.min'
}),
plugins.minifyCss(),
gulp.dest('style/css')
]);
// 任何在上面的 stream 中发生的错误,都不会抛出,
// 而是会被监听器捕获
combined.on('error', console.error.bind(console));
return combined;
});
gulp.watch('src/**/*.js', function (event) {
var paths = watchPath(event,'src/', 'dist/');
/*
paths {srcPath: 'src/file.js',
srcDir: 'src/',
distPath: 'dist/file.node',
distDir: 'dist/',
srcFilename: 'file.js',
distFilename: 'file.js' }
*/
var combined = combiner.obj([
gulp.src(paths.srcPath), // src/file.js
uglify(),
gulp.dest(paths.distDir) // dist/
]);
combined.on('error', function (err) {
console.log('--------------')
console.log('Error')
console.log('fileName: ' + err.fileName)
console.log('lineNumber: ' + err.lineNumber)
console.log('message: ' + err.message)
console.log('plugin: ' + err.plugin)
})
console.log('\n')
console.log(event.type + ': ' + paths.srcPath)
console.log('dist: ' + paths.distPath)
function copyToDist() {
combine.obj([
// ts
// copy
tsTranspileSystem(),
// minify System
gulp.src(pathToTs)
.pipe(tsc(tsconfig_system))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(destinations.system)),
tsTranspileCommonJs(),
// minify commonjs
function createUploadPackParser(opts): WritableStream {
return combine.obj(
// Parse as lines
createPackLineParser(),
// Parse metatdata of lines
createPackLineMetaParser(),
// Filter packs
es.map((line, callback) => {
if (line.type == LINEMETA_TYPES.PACKFILE) {
callback(null, line);
} else {
callback();
}
}),
// Parse pack as objects
parsePack(opts)
);
}
gulp.task('html', function(done){
combiner.obj([
gulp.src(config.paths.html)
.pipe(gulp.dest(config.paths.dist))
.pipe(connect.reload())
])
.on('error', console.error.bind(console));
done();
});
gulp.task('styles', () =>
combine(
gulp.src(paths.src.styles.entry),
$.if(IS_DEVELOPMENT, $.sourcemaps.init()),
$.sass(),
$.if(IS_DEVELOPMENT, $.sourcemaps.write()),
$.if(IS_DEVELOPMENT, gulp.dest(paths.root.src)),
$.if(!IS_DEVELOPMENT, gulp.dest(paths.root.dist)),
).on('error', $.notify.onError()),
);
gulp.watch('src/js/**/*.js', function (event) {
var paths = watchPath(event, 'src/', 'dist/')
/*
paths
{ srcPath: 'src/js/log.js',
srcDir: 'src/js/',
distPath: 'dist/js/log.js',
distDir: 'dist/js/',
srcFilename: 'log.js',
distFilename: 'log.js' }
*/
gutil.log(gutil.colors.green(event.type) + ' ' + paths.srcPath)
gutil.log('Dist ' + paths.distPath)
var combined = combiner.obj([
gulp.src(paths.srcPath),
uglify(),
gulp.dest(paths.distDir)
])
combined.on('error', handleError)
})
})
function py() {
var src = filter(['app/**/*.py'], {restore: true});
return combiner(
src,
print(),
filenameHint({regExp: /(^|\/)[a-z_0-9]+\.py$/}),
flake8('.flake8'),
flake8.failOnError(),
checkGrep(/datetime\.now\(\)/g, {message: 'Replace datetime.now by timezone.now'}),
checkGrep(/gettext/g, {message: 'Remove i18n'}),
checkGrep(/print\((.(?!noqa$))+$/gm, {message: 'print call'}),
checkGrep.failOnError(),
src.restore
);
}
function buildCSS() {
return combiner.obj([
$.sass(sassOptions),
$.autoprefixer({
browsers: ['last 2 versions'],
cascade: false,
flexbox: false
}),
gulpif(!argv.debug, $.cssmin())
]).on('error', handleError);
}
backoff.once('ready', loop)
return backoff.backoff()
}
}
const id = data[primaryKey]
delete inProgress[id]
cb(null, {
input: data,
output: val
})
})
})()
})
const transform = combine.obj(
registrar,
processor
)
transform.on('pause', () => paused = true)
transform.on('resume', () => paused = false)
if (!transform.destroy) {
transform.destroy = transform.end
}
return transform
}