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('styles-less', function() {
log('Compiling Less --> CSS');
return gulp
.src(config.less)
.pipe($.plumber()) // exit gracefully if something fails after this
.pipe($.less())
// .on('error', errorLogger) // more verbose and dupe output. requires emit.
.pipe($.autoprefixer({ browsers: ['last 2 version', '> 5%'] }))
.pipe(gulp.dest(config.temp));
});
// If separate polyfill files enabled
if (settings.polyfills) {
// Update the suffix
suffix = '.polyfills';
// Grab files that aren't polyfills, concatenate them, and process them
src([file.path + '/*.js', '!' + file.path + '/*' + paths.scripts.polyfills])
.pipe(concat(file.relative + '.js'))
.pipe(jsTasks());
}
// Grab all files and concatenate them
// If separate polyfills enabled, this will have .polyfills in the filename
src(file.path + '/*.js')
.pipe(concat(file.relative + suffix + '.js'))
.pipe(jsTasks());
return stream;
}
// Otherwise, process the file
return stream.pipe(jsTasks());
}));
(function () {
gulp.src(fixturesGlob)
.pipe(plumber({ errorHandler: false }))
.pipe(this.failingQueueStream)
.on('end', done);
}).should.throw();
done();
function srcForTypeScript() {
return gulp
.src(paths.output + paths.packageName + '.js')
.pipe(rename(function (path) {
if (path.extname == '.js') {
path.extname = '.ts';
}
}));
}
gulp.task('sass', function () {
return gulp.src('./assets/styles/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', err => {
sass.logError.bind(this,err);
throw err;
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./assets/bundled'));
});
function headerScriptsDev() {
return src(headerJS)
.pipe(plumber({ errorHandler: onError }))
.pipe(sourcemaps.init())
.pipe(concat('header-bundle.js'))
.pipe(sourcemaps.write('.'))
.pipe(dest('./build/wordpress/wp-content/themes/' + themeName + '/js'));
}
gulp.task('jshint', function() {
log('Analyzing source with JSHint and JSCS...');
return gulp.src(source)
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish', {verbose: true}))
.pipe($.jscs());
});
gulp.task('fonts', () => {
return gulp.src(require('main-bower-files')('**/*.{eot,svg,ttf,woff,woff2}', function (err) {})
.concat('app/fonts/**/*'))
.pipe(gulp.dest('.tmp/fonts'))
.pipe(gulp.dest('dist/fonts'));
});
gulp.task('copy', function(cb) {
return gulp.src(config.paths.public)
.pipe(gulp.dest(config.build.path))
.pipe(refresh(server));
});