Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Report compile errors
.on('error', notify.onError({
title: "JS Compile Error",
message: "<%= error.message %>"
}))
// Use vinyl-source-stream to make the
// stream gulp compatible. Specify the
// desired output filename here.
.pipe(source(bundleConfig.outputName))
.pipe(buffer())
.pipe(sourcemaps.init()) // loads map from browserify file
.pipe(sourcemaps.write('./')) // writes .map file
// Specify the output destination
.pipe(gulp.dest(bundleConfig.dest))
.on('end', reportFinished)
.pipe(browserSync.reload({stream:true}));
};
gulp.task('sass', function() {
return gulp.src('app/scss/**/*.scss') // Gets all files ending with .scss in app/scss and children dirs
.pipe(sass().on('error', sass.logError)) // Passes it through a gulp-sass, log errors to console
.pipe(gulp.dest('app/css')) // Outputs it in the css folder
.pipe(browserSync.reload({ // Reloading with Browser Sync
stream: true
}));
})
gulp.task('browserify', function() {
'use strict';
return browserify('./' + config.src + '/main.js')
.bundle()
.on('error', function (err) {
console.log(err.toString());
this.emit('end');
})
.pipe(source(pkg.name + '.js'))
.pipe(gulp.dest(config.dist))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('css', function() {
return gulp.src('src/scss/*.scss')
.pipe(sass({includePaths: ['./node_modules/'], outputStyle: 'compressed' }))
.on('error', gutil.log.bind(gutil, 'Sass Error'))
.pipe(autoprefixer({
browsers: ['> 0.5% in NZ', 'last 2 versions'],
cascade: false
}))
.pipe(gulp.dest(opts.dest + '/css'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('browser-reload', () => {
browserSync.reload();
});
gulp.task('sass', function () {
return gulp.src('src/scss/FsLightbox.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('src/css'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('styles', ['sass'], function () {
return gulp.src(config.app + 'content/css')
.pipe(browserSync.reload({stream: true}));
});
gulp.task('ng:docs/scripts', function() {
return merge(gulp.src(docs.scripts, {cwd: docs.cwd, base: docs.cwd}), gulp.src(docs.scripts, {cwd: cwd, base: cwd}))
.pipe(plumber(config.plumberErrorHandler))
.pipe(channels.scripts.src(gulp, config)(docs))
.pipe(reload({stream: true}));
});
gulp.watch('{' + options.src + ',' + options.common + '}' + '/**/*.html', function(event) {
browserSync.reload(event.path);
});
});
gulp.task('sass', function() {
var styles = gulp.src('scss/**/*.scss')
.pipe(sass({outputStyle: 'expanded'})
.on('error', sass.logError));
if (options.minify) {
styles.pipe(minifyCss());
}
styles.pipe(gulp.dest(options.dest))
.pipe(browserSync.reload({
stream: true
}));
});