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('rev-assets', function() {
// Ignore files that may reference assets. We'll rev them next.
var ignoreThese = '!' + path.join(config.root.dest,'/**/*+(css|js|xml|json|html)');
return gulp.src([path.join(config.root.dest,'/**/*'), ignoreThese])
.pipe(rev())
.pipe(gulp.dest(config.root.dest))
.pipe(revNapkin({verbose: false}))
.pipe(rev.manifest(path.join(config.root.dest, 'rev-manifest.json'), {merge: true}))
.pipe(gulp.dest(''));
});
gulp.task('rev-assets', function() {
// Ignore files that may reference assets. We'll rev them next.
var ignoreThese = '!' + path.join(config.root.dest,'/**/*+(css|js|json|html|svg)')
return gulp.src([path.join(config.root.dest,'/**/*'), ignoreThese])
.pipe(rev())
.pipe(gulp.dest(config.root.dest))
.pipe(revNapkin({verbose: false}))
.pipe(rev.manifest(path.join(config.root.dest, 'rev-manifest.json'), {merge: true}))
.pipe(gulp.dest(''))
})
gulp.task('rev-assets', function() {
// Ignore files that may reference assets. We'll rev them next.
var ignoreThese = '!' + path.join(config.root.dest,'/**/*+(json|html|php)')
return gulp.src([path.join(config.root.dest,'/**/*'), ignoreThese])
.pipe(rev())
.pipe(gulp.dest(config.root.dest))
.pipe(revNapkin({verbose: false}))
.pipe(rev.manifest(path.join(config.root.dest, 'rev-manifest.json'), {merge: true}))
.pipe(gulp.dest(''))
})
};
async function compile() {
return src('build/js/**/*.js', {
since: lastRun(compile)
})
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(envify(env))
.pipe(unassert())
.pipe(babel())
.pipe(gulpif(PROD, terser()))
.pipe(gulpif(PROD, rev()))
.pipe(sourcemaps.write('./'))
.pipe(dest(config.buildBase))
.pipe(gulpif(DEV, lr(config.livereload)))
.pipe(gulpif(PROD, rev.manifest(config.manifest, manifestOptions)))
.pipe(gulpif(PROD, dest(config.buildBase)));
}
gulp.task('bowerScripts', tasks, function() {
var result = gulp.src(bowerFiles(bowerFilesOptions))
.pipe(gulpif(config.build.bowerDebug, debug()))
.pipe(sourceMaps.init())
.pipe(gulpif(isFirstRun, newer(config.bowerScripts.dest + vendorFile)))
.pipe(concat(vendorFile))
.pipe(gulpif(config.build.uglify, uglify()))
.pipe(gulpif(config.build.rev, rev()))
.pipe(sourceMaps.write(config.build.sourceMapPath))
.pipe(gulp.dest(config.bowerScripts.dest))
.pipe(gulpif(config.build.rev, rev.manifest({cwd: config.statics.dest, merge: true})))
.pipe(gulpif(config.build.rev, gulp.dest(config.statics.dest)));
isFirstRun = false;
return result;
});
};
var optionsRev = {
manifest: gulp.src('./' + config.fonts.dest + 'rev-manifest.json')
};
}
return gulp.src(config.styles.src)
.pipe(sourceMaps.init())
.pipe(gulpif(config.preprocess && config.preprocess.apply.styles, preprocess(config.preprocess)))
.pipe(sass(optionsSass).on('error', sass.logError))
.pipe(autoPrefixer(config.styles.prefixer))
.pipe(gulpif(config.build.rev && config.fonts, revReplace(optionsRev)))
.pipe(gulpif(config.build.rev, rev()))
.pipe(sourceMaps.write(config.build.sourceMapPath))
.pipe(gulp.dest(config.styles.dest))
.pipe(browserSync.stream({match: '**/*.css'}))
.pipe(gulpif(config.build.rev, rev.manifest({cwd: config.statics.dest, merge: true})))
.pipe(gulpif(config.build.rev, gulp.dest(config.statics.dest)));
});
};
function styles() {
return gulp.src(paths.styles.src)
.pipe(sourcemaps.init())
.pipe(postcss([
require('postcss-import'),
require('tailwindcss')('./tailwind.js'),
require('precss'),
require('postcss-preset-env')({stage: 0}),
require('autoprefixer'),
]))
.pipe(gulpif(argv.production, cssmin()))
.pipe(concat('bundle.css'))
.pipe(rev())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.styles.dest))
.pipe(rev.manifest(paths.manifest + '/manifest.json', {merge: true, base: paths.manifest}))
.pipe(gulp.dest(paths.manifest));
}
gulp.task('rev-css', function(){
console.log(config.root.dest);
return gulp.src(path.join(config.root.dest,'/**/*.css'))
.pipe(rev())
.pipe(minify())
.pipe(gulp.dest(config.root.dest))
.pipe(revNapkin({verbose: false}))
.pipe(rev.manifest(path.join(config.root.dest, 'rev-manifest.json'), {merge: true}))
.pipe(gulp.dest(''));
});
gulp.task('screenshot:rev', ['screenshot:clean'], function () {
return gulp.src('public/themes/screenshots/*.png')
.pipe(gulpRev())
.pipe(gulp.dest(dirs.screenshots))
.pipe(gulpRev.manifest())
.pipe(gulp.dest(dirs.screenshots))
})
gulp.task('styles-manifest', () =>
gulp.src(['layout'].map(item => 'public/css/' + item + '.css'))
.pipe(rev())
.pipe(gulp.dest('public/css'))
.pipe(rev.manifest('manifest-css.json', {merge: true}))
.pipe(gulp.dest('.'))
);