Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.on('error', function(err){
browserSync.notify("SASS error");
console.error(err.message);
// Save the error to index.html, with a simple HTML wrapper
// so browserSync can inject itself in.
fs.writeFileSync('serve/index.html', "<pre>" + err.message + "</pre>");
// No need to continue processing.
this.emit('end');
})
// AutoPrefix your CSS so it works between browsers
gulp.task('scripts', function(callback) {
browsersync.notify('Compiling JavaScript');
var bundleQueue = config.bundleConfigs.length;
var browserifyThis = function(bundleConfig) {
var bundler = browserify({
// Required watchify args
cache: {}, packageCache: {}, fullPaths: false,
// Specify the entry point of your app
entries: bundleConfig.entries,
// Add file extentions to make optional in your requires
extensions: config.extensions,
// Enable source maps!
debug: config.debug
});
export const jekyll = done => {
browser.notify('Compiling Jekyll')
let jekyllOptions
if (isProduction) {
process.env.JEKYLL_ENV = 'production'
jekyllOptions = 'jekyll build --lsi'
} else {
process.env.JEKYLL_ENV = 'development'
jekyllOptions = 'jekyll build --config _config.yml,_config.dev.yml --incremental --drafts --future'
}
const jekyll = cp.execFile('bundle', ['exec', jekyllOptions], { stdio: 'inherit' })
const jekyllLogger = buffer => {
buffer.toString()
.split(/\n/)
function errorHandler(error) {
browserSync.notify(error.message, 3000);
log('[Error!] ' + error.toString());
if (process.argv.indexOf('--fail') !== -1) {
process.exit(1);
}
}
setTimeout(function() {
browserSync.notify('reloading now ...');
browserSync.reload({stream: false});
}, config.browserReloadDelay);
})
gulp.task('sass', function () {
browserSync.notify('<span style="color: grey">Running:</span> Sass compiling');
return gulp.src(settings.sass + '/**/*.scss')
.pipe($.sass(eyeglass.sassOptions()).on("error", $.sass.logError))
.pipe($.autoprefixer('last 2 versions', '> 1%'))
.pipe(gulp.dest(settings.css))
.pipe(gulp.dest(settings.assets))
.pipe(browserSync.reload({stream: true}));
});
setTimeout(function() {
browserSync.notify('reloading now ...');
browserSync.reload({stream: false});
}, config.browserReloadDelay);
})
gulp.task('jekyll-dev', function (cb) {
browserSync.notify('<span style="color: grey">Running:</span> $ jekyll build');
return cp.spawn('bundle', ['exec', 'jekyll', 'build', '--config=_config.yml,_config.dev.yml'], {stdio: 'inherit'})
.on('close', cb);
});
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
.on('close', done);
});
gulp.task( "jekyll-build", done => {
browserSync.notify( messages.jekyllBuild );
return cp.spawn( jekyll, [ "build" ], { stdio: "inherit" } )
.on( "close", done );
} );