const gulp = require('gulp')
const serve = require('./gulp/tasks/serve')
const pug2html = require('./gulp/tasks/pug2html')
const styles = require('./gulp/tasks/styles')
const script = require('./gulp/tasks/script')
const fonts = require('./gulp/tasks/fonts')
const imageMinify = require('./gulp/tasks/imageMinify')
const clean = require('./gulp/tasks/clean')
const copyDependencies = require('./gulp/tasks/copyDependencies')
const lighthouse = require('./gulp/tasks/lighthouse')
const svgSprite = require('./gulp/tasks/svgSprite')
function setMode(isProduction = false) {
return cb => {
process.env.NODE_ENV = isProduction ? 'production' : 'development'
cb()
}
}
const dev = gulp.parallel(pug2html, styles, script, fonts, imageMinify, svgSprite)
const build = gulp.series(clean, copyDependencies, dev)
module.exports.start = gulp.series(setMode(), build, serve)
module.exports.build = gulp.series(setMode(true), build)
module.exports.lighthouse = gulp.series(lighthouse)
const gulp = require('gulp')
const imagemin = require('gulp-imagemin')
module.exports = function imageMinify() {
return gulp.src('src/img/*.{gif,png,jpg,svg,webp}')
.pipe(imagemin([
imagemin.gifsicle({ interlaced: true }),
imagemin.mozjpeg({
quality: 75,
progressive: true
}),
imagemin.optipng({ optimizationLevel: 5 }),
imagemin.svgo({
plugins: [
{ removeViewBox: true },
{ cleanupIDs: false }
]
})
]))
.pipe(gulp.dest('build/img'))
}
<?php $posts = get_posts ("category=35&numberposts=6"); ?>
<?php if ($posts) : ?>
<?php foreach ($posts as $post) : setup_postdata ($post); ?>
<div>
<div>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<p><?php the_title(); ?></p>
<?php the_post_thumbnail($size = "thumbnail" ); ?>
</a>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>