Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
feat(build): added imagemin to gulp
Browse files Browse the repository at this point in the history
in order to minify images,
gulp is now given an imagemin task
  • Loading branch information
accraze committed Jan 14, 2016
1 parent b9e3fd1 commit 1a3f6f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/assets/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ module.exports = {
'modules/*/client/*.js',
'modules/*/client/**/*.js'
],
img: [
'modules/**/*/img/**/*.jpg',
'modules/**/*/img/**/*.png',
'modules/**/*/img/**/*.gif',
'modules/**/*/img/**/*.svg'
],
views: ['modules/*/client/views/**/*.html'],
templates: ['build/templates.js']
},
Expand Down
12 changes: 12 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var _ = require('lodash'),
'gulp-angular-templatecache': 'templateCache'
}
}),
pngquant = require('imagemin-pngquant'),
path = require('path'),
endOfLine = require('os').EOL,
argv = require('yargs').argv,
Expand Down Expand Up @@ -190,6 +191,17 @@ gulp.task('less', function () {
.pipe(gulp.dest('./modules/'));
});

// Imagemin task
gulp.task('imagemin', function () {
return gulp.src(defaultAssets.client.img)
.pipe(plugins.imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('public/dist/img'));
});

// Angular template cache task
gulp.task('templatecache', function () {
var re = new RegExp('\\' + path.sep + 'client\\' + path.sep, 'g');
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"gulp-csslint": "~0.1.5",
"gulp-cssmin": "~0.1.7",
"gulp-eslint": "~1.0.0",
"gulp-imagemin": "~2.4.0",
"gulp-jshint": "^1.11.2",
"gulp-less": "^3.0.3",
"gulp-livereload": "^3.8.0",
Expand All @@ -104,6 +105,7 @@
"gulp-sass": "^2.0.3",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.6",
"imagemin-pngquant": "~4.2.0",
"istanbul": "~0.4.1",
"karma": "~0.13.15",
"karma-chrome-launcher": "~0.2.0",
Expand Down

0 comments on commit 1a3f6f8

Please sign in to comment.