adding image optimization task

This commit is contained in:
koenemann 2017-03-21 14:53:49 +01:00
parent b80800435f
commit 5ac4257c00
4 changed files with 20 additions and 7 deletions

View File

@ -7,7 +7,7 @@
?> ?>
<?php if ( is_active_sidebar( 'hero' ) or is_active_sidebar( 'statichero' ) ) : ?> <?php if ( is_active_sidebar( 'hero' ) || is_active_sidebar( 'statichero' ) ) : ?>
<div class="wrapper" id="wrapper-hero"> <div class="wrapper" id="wrapper-hero">

View File

@ -33,6 +33,7 @@ var rename = require('gulp-rename');
var concat = require('gulp-concat'); var concat = require('gulp-concat');
var uglify = require('gulp-uglify'); var uglify = require('gulp-uglify');
var merge2 = require('merge2'); var merge2 = require('merge2');
var imagemin = require('gulp-imagemin');
var ignore = require('gulp-ignore'); var ignore = require('gulp-ignore');
var rimraf = require('gulp-rimraf'); var rimraf = require('gulp-rimraf');
var clone = require('gulp-clone'); var clone = require('gulp-clone');
@ -102,7 +103,19 @@ gulp.task('sass', function () {
gulp.task('watch', function () { gulp.task('watch', function () {
gulp.watch('./sass/**/*.scss', ['sass']); gulp.watch('./sass/**/*.scss', ['sass']);
gulp.watch('./css/theme.css', ['cssnano']); gulp.watch('./css/theme.css', ['cssnano']);
gulp.watch([basePaths.dev + 'js/**/*.js','js/**/*.js','!js/theme.js','!js/theme.min.js'], ['scripts']) gulp.watch([basePaths.dev + 'js/**/*.js','js/**/*.js','!js/theme.js','!js/theme.min.js'], ['scripts']);
//Inside the watch task.
gulp.watch('./img', ['imagemin'])
});
// Run:
// gulp imagemin
// Running image optimizing task
gulp.task('imagemin', function(){
gulp.src('img/*')
.pipe(imagemin())
.pipe(gulp.dest('img'))
}); });

View File

@ -22,7 +22,8 @@
<?php <?php
if ( is_home() && current_user_can( 'publish_posts' ) ) : ?> if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'understrap' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p> <p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'understrap' ),
array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
<?php elseif ( is_search() ) : ?> <?php elseif ( is_search() ) : ?>

View File

@ -6,11 +6,9 @@
"scripts": { "scripts": {
"postinstall": "gulp copy-assets" "postinstall": "gulp copy-assets"
}, },
"engines": {
"engines" : { "npm": ">=2.1.8"
"npm" : ">=2.1.8"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/holger1411/understrap.git" "url": "https://github.com/holger1411/understrap.git"
@ -38,6 +36,7 @@
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-cssnano": "^2.1.2", "gulp-cssnano": "^2.1.2",
"gulp-ignore": "^2.0.2", "gulp-ignore": "^2.0.2",
"gulp-imagemin": "^3.1.1",
"gulp-merge": "^0.1.1", "gulp-merge": "^0.1.1",
"gulp-plumber": "^1.1.0", "gulp-plumber": "^1.1.0",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",