const $ = plugins();
// Look for the --production flag
-const isProduction = !!(yargs.argv.production);
+const PRODUCTION = !!(yargs.argv.production);
// Only inline if the --production flag is enabled
var buildTasks = [clean, pages, sass, images];
-if (isProduction) buildTasks.push(inline);
+if (PRODUCTION) buildTasks.push(inline);
// Build the "dist" folder by running all of the above tasks
gulp.task('build',
.pipe(gulp.dest('dist'));
}
+// Reset Panini's cache of layouts and partials
function resetPages(done) {
panini.refresh();
done();
// Compile Sass into CSS
function sass() {
return gulp.src('src/assets/scss/app.scss')
- .pipe($.if(!isProduction, $.sourcemaps.init()))
+ .pipe($.if(!PRODUCTION, $.sourcemaps.init()))
.pipe($.sass().on('error', $.sass.logError))
- .pipe($.if(!isProduction, $.sourcemaps.write()))
+ .pipe($.if(!PRODUCTION, $.sourcemaps.write()))
.pipe(gulp.dest('dist/css'));
}
gulp.watch('src/img/**/*', gulp.series(images, browser.reload));
}
+// Inlines CSS into HTML, adds media query CSS into the <style> tag of the email, and compresses the HTML
function inliner(options) {
var cssPath = options.css;
var cssMqPath = cssPath.replace(/\.css$/, '-mq.css');