Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function compile(production) {
return gulp.src(gulp._.config.html.src, {base: gulp._.config.base})
.pipe(gulp._.plugins.pipes.html.compile({
prod: production
}))
.pipe(gulp._.plugins.if(production, gulp._.plugins.replace('app-dependencies.', 'app-dependencies.min.')))
.pipe(gulp.dest(gulp._.config.html.dest));
}
function compile(type, production) {
var userSpecific = gulp._.config.app.deps[type] || [];
var src = mapDependencies(
gulp._.config.deps[type].src.concat(userSpecific),
production,
'.' + type,
production
);
var pipe = gulp.src(src)
.pipe(gulp._.plugins.newer(gulp._.config.deps[type].dest + '/' + gulp._.config.deps.name + '.' + type))
.pipe(gulp._.plugins.pipes[type].deps({
prod: production,
name: gulp._.config.deps.name
}))
.pipe(gulp.dest(gulp._.config.deps[type].dest));
if (type === 'css') {
function compile(production) {
return gulp.src(gulp._.config.css.src, {base: gulp._.config.base})
.pipe(gulp._.plugins.pipes.css.compile({
prod: production
}))
.pipe(gulp.dest(gulp._.config.css.dest))
.pipe(gulp._.config.browser.stream());
}
gulp.task('js:copy', function() {
return gulp.src(gulp._.config.js.src, {base: gulp._.config.base})
.pipe(gulp.dest(gulp._.config.js.tmp.dest));
});
function compile(production) {
return gulp.src(gulp._.config.layouts.src)
.pipe(gulp._.plugins.pipes.js.compile({
prod: production,
pack: gulp._.config.webpack
}))
.pipe(gulp.dest(gulp._.config.layouts.dest));
}
gulp.task('dist:finalize', function() {
gulp.src(gulp._.config.dist.src)
.pipe(gulp.dest(gulp._.config.dist.dest));
});
'use strict';
var
gulp = require('gulp'),
fs = require('fs'),
yaml = require('js-yaml'),
path = require('path'),
glob = require('glob')
;
var
pageLen = (gulp._.config.base + '/pages/').length,
layoutLen = (gulp._.config.base + '/layouts/').length
;
function getName(manifestPath, len) {
return path.dirname(manifestPath).substring(len);
}
function getManifest(prefix, len, globFiles) {
var
manifests = glob.sync(globFiles),
pages = {},
config, pageName, cssFile
;
manifests.forEach(function(manifestPath) {
config = yaml.load(fs.readFileSync(manifestPath)) || {};
module.exports = function() {
return JSON.stringify({
pages: getManifest('style', pageLen, gulp._.config.appManifest.watch.pages),
layouts: getManifest('layout', layoutLen, gulp._.config.appManifest.watch.layouts)
});
};
function processJS(done, production) {
gulp._.sequence(
['js:lint', 'js:copy'],
'js:manifest',
'js:compile:' + (production ? 'prod' : 'dev'),
'js:clean',
done
);
}
function compile(production) {
var pipe = gulp.src(gulp._.config.assets.src, {base: gulp._.config.base})
.pipe(gulp._.plugins.changed(gulp._.config.assets.dest));
if (production) {
pipe.pipe(gulp._.plugins.pipes.image.optimize());
}
return pipe.pipe(gulp.dest(gulp._.config.assets.dest));
}