Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.pipe($.if('*.css', $.cleanCss({compatibility: '*'})))
.pipe($.if('*.js', $.sourcemaps.init()))
// .pipe($.if('*.js', $.uglify()))
.pipe($.if('*.js', $.sourcemaps.write('.')))
.pipe(gulp.dest('dist'));
});
gulp.task('babel', () => {
return gulp.src('app/scripts.babel/**/*.js')
.pipe($.babel({
presets: ['es2015']
}))
.pipe(gulp.dest('app/scripts'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('watch', ['lint', 'babel'], () => {
$.livereload.listen();
gulp.watch([
'app/*.html',
'app/scripts/**/*.js',
'app/images/**/*',
'app/styles/**/*',
'app/_locales/**/*.json'
]).on('change', $.livereload.reload);
gulp.watch('app/scripts.babel/**/*.js', ['lint', 'babel']);
gulp.watch('bower.json', ['wiredep']);
});
});
gulp.task('partials', ['styles'], function () {
var assets = $.useref.assets({searchPath: '{.tmp,themes/src}'});
return gulp.src('themes/src/layouts/**/*.html')
.pipe(assets)
.pipe($.if('*.js', $.uglify()))
.pipe($.if('*.css', $.csso()))
.pipe(assets.restore())
.pipe($.useref())
.pipe($.if('*.html', $.htmlclean()))
.pipe(gulp.dest(theme + 'layouts/'));
});
gulp.task('clean', require('del').bind(null, [theme + 'layouts', theme + 'static/assets/css/*.css', theme + 'static/assets/*.js']));
gulp.task('watch', function () {
// watch for changes
gulp.watch([
'*.html',
theme + 'static/css/**/*.css',
'scripts/**/*.js',
]).on('change', $.livereload.changed);
gulp.watch('themes/src/styles/**/*.styl', ['styles']);
gulp.watch('themes/src/scripts/**/*.js', ['scripts']);
gulp.watch('themes/src/**/*.html', ['html']);
gulp.watch('themes/src/**/*.html', ['partials']);
});
gulp.task('clearcache', function() {
'baseDir': [ '.tmp', 'app', '.tmp_examples' ]
},
'ports': {
'min': 9090,
'max': 9090
}
});
gulp.watch([srcFolder + '/**/*.html'], [ 'html:compile', reload ]);
gulp.watch([srcFolder + '/**/*.{css,scss}'], ['styles']);
gulp.watch(['.tmp/styles/**/*.css'], reload);
gulp.watch([srcFolder + '/**/*.js'], [ 'js:compile', reload ]);
// gulp.watch(['app/fonts/**/*'], ['fonts']);
});
gulp.task('clean', del.bind(null, [ '.tmp', 'test_out', distFolder ]));
gulp.task('dist', ['clean'], function (cb) {
runSequence('styles', [ 'html', 'fonts', 'images' ], cb);
});
gulp.task('default', [], function (cb) {
runSequence('dist', cb);
});
gulp.task('test', ['bower'], function () {
return gulp.src('./idontexist') // https://github.com/lazd/gulp-karma/issues/9
.pipe($.karma({
'configFile': './karma.conf.js',
'autoWatch': false
}))
var pkgs = (function() {
var pkgs = {};
var map = function(source) {
for (var key in source) {
pkgs[key.replace(/[^a-z0-9]/gi, '')] = source[key].substring(1);
}
};
map(require('./package.json').dependencies);
return pkgs;
}());
// The default task
gulp.task('default', ['serve']);
// Clean up
gulp.task('clean', del.bind(null, [DEST]));
// 3rd party libraries
gulp.task('vendor', function() {
src.vendor = [
'bower_components/todomvc-common/base.{js,css}',
'bower_components/todomvc-common/bg.png'
];
return merge(
gulp.src(src.vendor)
.pipe(gulp.dest(DEST + '/vendor')),
gulp.src('./node_modules/bootstrap/dist/fonts/**')
.pipe(gulp.dest(DEST + '/fonts'))
);
});
// Static files
})))
.pipe($.if('*.js', $.sourcemaps.init()))
.pipe($.if('*.js', $.uglify()))
.pipe($.if('*.js', $.sourcemaps.write('.')))
.pipe(gulp.dest('dist'));
});
gulp.task('babel', () => {
return gulp.src('app/scripts.babel/**/*.js')
.pipe($.babel({
presets: ['es2015']
}))
.pipe(gulp.dest('app/scripts'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('watch', ['lint', 'babel'], () => {
$.livereload.listen();
gulp.watch([
'app/*.html',
'app/scripts/**/*.js',
'app/images/**/*',
'app/styles/**/*',
'app/_locales/**/*.json'
]).on('change', $.livereload.reload);
gulp.watch('app/scripts.babel/**/*.js', ['lint', 'babel']);
gulp.watch('bower.json', ['wiredep']);
});
.pipe($.if('*.css', $.cleanCss({compatibility: '*'})))
.pipe($.if('*.js', $.sourcemaps.init()))
.pipe($.if('*.js', $.uglify()))
.pipe($.if('*.js', $.sourcemaps.write('.')))
.pipe(gulp.dest('dist'));
});
gulp.task('babel', () => {
return gulp.src('app/scripts.babel/**/*.js')
.pipe($.babel({
presets: ['es2015']
}))
.pipe(gulp.dest('app/scripts'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('watch', ['lint', 'babel'], () => {
$.livereload.listen();
gulp.watch([
'app/*.html',
'app/scripts/**/*.js',
'app/images/**/*',
'app/styles/**/*.css',
'app/_locales/**/*.json'
]).on('change', $.livereload.reload);
gulp.watch('app/scripts.babel/**/*.js', ['lint', 'babel']);
gulp.watch('app/styles.scss/**/*.scss', ['styles']);
gulp.watch('bower.json', ['wiredep']);
});
output: {
filename: filename
}});
webpack(config,function (err,stats){
if(err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
}));
callback();
});
}
gulp.task('clean', del.bind(
null, ['build/*'], {dot: true}
));
gulp.task('chrome',["chrome:assets","chrome:background","chrome:stop"]);
gulp.task("chrome:assets", function() {
var assets = [
"chrome/**/.css",
"chrome/libs/**/*.js",
"chrome/img/**/*",
"chrome/**/*.css",
"chrome/**/*.html",
"chrome/**/*.json"
]
return gulp.src(assets,{ base: "./chrome"})
exclude: 'index.manifest'
}))
.pipe(gulp.dest('dist'));
});
gulp.task('extras', function () {
return gulp.src([
'LICENSE',
'src/*.*',
'!src/*.html'
], {
dot: true
}).pipe(gulp.dest('dist'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('serve', ['styles', 'scripts', 'fonts'], function () {
browserSync({
notify: false,
port: 9000,
server: {
baseDir: ['.tmp', 'src'],
routes: {
'/bower_components': 'bower_components'
}
}
});
gulp.watch([
'src/*.html',
'src/*.ico',
filter: '**/*.{eot,svg,ttf,woff,woff2}'
}).concat('app/fonts/**/*'))
.pipe(gulp.dest('.tmp/fonts'))
.pipe(gulp.dest('dist/fonts'));
});
gulp.task('extras', () => {
return gulp.src([
'app/*.*',
'!app/*.html'
], {
dot: true
}).pipe(gulp.dest('dist'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('serve', ['styles', 'fonts'], () => {
browserSync({
notify: false,
port: 9000,
server: {
baseDir: ['.tmp', 'app'],
routes: {
'/bower_components': 'bower_components'
}
}
});
gulp.watch([
'app/*.html',
'app/scripts/**/*.js',