Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
])
.pipe($.angularFilesort()).on('error', errorHandler('AngularFilesort'));
// make the path relative
var injectOptions = {
ignorePath: [path.join(options.paths.src, 'app'), options.paths.tmp],
addRootSlash: false
};
return gulp.src(path.join(options.paths.src, '*.html'))
.pipe(injectCSP()) // inject:csp
.pipe(injectAppInfo()) // inject:appinfo
.pipe($.inject(cssFiles, injectOptions)) // inject:css
.pipe($.inject(jsFiles, injectOptions)) // inject:js
.pipe(wiredep()) // bower:css
.pipe(gulp.dest(options.paths.tmp));
/* Important: While using both, `wiredep` should always run after `inject` in the pipe */
});
var stream = gulp
// Write the revisioned files
.src([].concat(minified, index)) // add all staged min files and index.html
.pipe(minFilter) // filter the stream to minified css and js
.pipe(plug.rev()) // create files with rev's
.pipe(gulp.dest(pkg.paths.stage)) // write the rev files
.pipe(minFilter.restore()) // remove filter, back to original stream
// inject the files into index.html
.pipe(indexFilter) // filter to index.html
.pipe(inject('content/vendor.min.css', 'inject-vendor'))
.pipe(inject('content/all.min.css'))
.pipe(inject('vendor.min.js', 'inject-vendor'))
.pipe(inject('all.min.js'))
.pipe(gulp.dest(pkg.paths.stage)) // write the rev files
.pipe(indexFilter.restore()) // remove filter, back to original stream
// replace the files referenced in index.html with the rev'd files
.pipe(plug.revReplace()) // Substitute in new filenames
.pipe(gulp.dest(pkg.paths.stage)) // write the index.html file changes
.pipe(plug.rev.manifest()) // create the manifest (must happen last or we screw up the injection)
.pipe(gulp.dest(pkg.paths.stage)); // write the manifest
function inject(path, name) {
var glob = pkg.paths.stage + path;
var options = {
ignorePath: pkg.paths.stage.substring(1),
read: false
};
if (name) { options.name = name; }
return plug.inject(gulp.src(glob), options);
gulp.task('buildBundle', ['styles', 'buildScripts'], function () {
return gulp.src('./app/index.html')
.pipe($.useref.assets())
.pipe($.useref.restore())
.pipe($.useref())
.pipe(gulp.dest('dist/public'))
})
var bump = function(type) {
gulp.src(['./bower.json', './package.json'])
.pipe(gbump({type: type}))
.pipe(gulp.dest('./'));
};
gulp.task('polyfill', () => {
gulp.src('app/scripts/polyfill.js')
.pipe(gulp.dest('dist/scripts'))
.pipe(uglify())
.pipe(rename('polyfill.min.js'))
.pipe(gulp.dest('app/scripts'));
});
gulp.task("compile-jade", function () {
gulp.src(["src/**/*.jade", "!./src/includes/**/*.*"])
.pipe(plumber())
.pipe(jade({locals: require('./src/context')}))
.pipe(gulp.dest("httpdocs"))
.pipe(connect.reload());
});
gulp.task('image', function(){
gulp.src('src/img/**')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('dist/img'));
gulp.src('src/sound/**')
.pipe(gulp.dest('dist/sound'));
gulp.src('src/fonts/**')
.pipe(gulp.dest('dist/fonts'));
});
gulp.task("build-images-backgrounds", function () {
return gulp.src([
"src/images/bg/*.{jpg,jpeg}"
])
.pipe(imageResize({
width: 4096,
quality: 0.8,
format: "jpg"
}))
.pipe(gulpif(PRODUCTION, imageop({
optimizationLevel: 5,
progressive: true,
interlaced: true
})))
.pipe(gulp.dest("Server/web/images/bg"));
});
.pipe(cssFilter.restore)
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.pipe(htmlFilter)
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true,
conditionals: true
}))
.pipe(htmlFilter.restore)
.pipe(htmlIndexFilter)
.pipe($.header(licences.html, {year: new Date().getFullYear()}))
.pipe(htmlIndexFilter.restore)
.pipe(gulp.dest(path.join(conf.paths.dist, '/')))
.pipe($.size({title: path.join(conf.paths.dist, '/'), showFiles: true}));
}
gulp.task('images:optimize', () => {
let options = {
progressive: true,
svgoPlugins: [{
removeViewBox: false
}]
//, use: [pngquant()]
};
gulp
.src(paths.images)
.pipe(imagemin(options))
.pipe(gulp.dest(`${paths.images}/opt`));
});