run imagemin & svgmin

This commit is contained in:
Matthias Kretschmann 2014-10-11 16:54:10 +02:00
parent b430656a38
commit b942f506ad
10 changed files with 44 additions and 50 deletions

View File

@ -1,6 +1,6 @@
module.exports = function(grunt){
'use strict';
// banner
grunt.log.writeln("");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
@ -9,11 +9,11 @@ module.exports = function(grunt){
grunt.log.writeln("");
grunt.log.writeln(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>");
grunt.log.writeln("");
// Grunt config
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// less
less: {
dist: {
@ -29,10 +29,10 @@ module.exports = function(grunt){
},
},
},
// image optimization
imagemin: {
assets: {
dist: {
options: {
optimizationLevel: 7
},
@ -40,13 +40,39 @@ module.exports = function(grunt){
{
expand: true,
cwd: 'badged/admin/assets/img/',
src: ['**/*.{png,jpg,jpeg,gif,svg}'],
src: ['**/*.{png,jpg,jpeg,gif}'],
dest: 'badged/admin/assets/img/'
},
{
expand: true,
cwd: 'assets/',
src: ['**/*.{png,jpg,jpeg,gif}'],
dest: 'assets/'
}
]
},
}
},
// svg optimization
svgmin: {
dist: {
files: [
{
expand: true,
cwd: 'badged/admin/assets/img/',
src: ['**/*.svg'],
dest: 'badged/admin/assets/img/'
},
{
expand: true,
cwd: 'assets/',
src: ['**/*.svg'],
dest: 'assets/'
}
]
}
},
// watch
watch: {
less: {
@ -54,30 +80,31 @@ module.exports = function(grunt){
tasks: ['less']
}
}
});
// Load NPM Tasks, smart code stolen from @bluemaex <https://github.com/bluemaex>
require('fs').readdirSync('node_modules').filter(function (file) {
return file && file.indexOf('grunt-') > -1;
}).forEach(function (file) {
grunt.loadNpmTasks(file);
});
// Default Task
grunt.registerTask('default', [
'watch'
]);
// Dev server
grunt.registerTask('server', [
'less',
'watch'
]);
// Production build
grunt.registerTask('build', [
'imagemin',
'svgmin',
'less'
]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

@ -1,18 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="128" height="128" viewBox="0 0 128 128">
<defs>
<style>
.cls-4 {
fill: #7cacb0;
}
.cls-5 {
fill: #d0f2f5;
}
</style>
</defs>
<g id="iconsvg">
<circle id="circle-1" class="cls-4" cx="65" cy="65" r="46"/>
<path d="M64.145,57.234 C64.145,57.234 64.145,81.000 64.145,81.000 C64.145,81.000 68.645,81.000 68.645,81.000 C68.645,81.000 68.645,47.578 68.645,47.578 C68.645,47.578 65.316,47.578 65.316,47.578 C64.722,50.172 63.824,51.817 62.621,52.512 C61.418,53.207 59.293,53.703 56.246,54.000 C56.246,54.000 56.246,57.234 56.246,57.234 C56.246,57.234 64.145,57.234 64.145,57.234 Z" id="path-1" class="cls-5" fill-rule="evenodd"/>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="128" height="128" viewBox="0 0 128 128"><defs><style>.cls-3 { fill: #d0f2f5; } .cls-4 { fill: #7cacb0; }</style></defs><g id="iconsvg"><path id="rect-1" class="cls-3" d="M0 0h128v128H0z"/><circle id="circle-1" class="cls-4" cx="65" cy="65" r="46"/><path d="M64.145 57.234V81h4.5V47.578h-3.33c-.593 2.594-1.49 4.24-2.694 4.934-1.202.695-3.327 1.19-6.374 1.488v3.234h7.9z" id="path-1" class="cls-3" fill-rule="evenodd"/></g></svg>

Before

Width:  |  Height:  |  Size: 821 B

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,18 +1 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g>
<g>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.989,10V9h-2.07V8h1.734V7.03h-1.734V6h0.705V5H13.93V4.949h-0.011V4.266H13
v0.683h-1.162V3.926l1.776-0.018c0,0,0.149-0.005,0.387-0.005C13.241,2.953,10.625,2,9.313,2C7.534,2,6.02,3.466,5.433,5.042
C5.085,4.567,4.528,4,3.893,4C2.836,4,1.98,5.112,1.98,6.169c0,0.087,0.015,0.171,0.026,0.255C0.866,6.91,0.067,8.039,0.067,9.357
c0,1.761,1.428,3.63,3.188,3.63h8.3V13h2.027v-0.766h-1.745V11.54H13v0.683h0.919V11.54h1.03v-0.347h-1.03V10H15.989z M13,9
h-1.162V8H13V9z M13,7.03h-1.162V6H13V7.03z M10.754,6.662l0.022-0.325l0.39-0.022L11.159,6h0.332v1.03h-1.084V6.662H10.754z
M11.469,3.93l0.022,0v0.304v0.715h-0.354l-0.015-0.694l0.369-0.022L11.469,3.93z M9,8l1.168-0.265V8h1.322v1h-0.683v0.09H9.065
L9,8z M11.139,10h0.352v1.605c-0.176-0.468-0.323-0.995-0.347-1.497C11.142,10.066,11.141,10.039,11.139,10z M13,11.193h-1.162V10
H13V11.193z"/>
</g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M15.99 10V9h-2.07V8h1.733v-.97H13.92V6h.704V5h-.694v-.05h-.01v-.684H13v.683h-1.162V3.924l1.776-.018s.15-.005.387-.005C13.24 2.952 10.627 2 9.315 2c-1.78 0-3.293 1.466-3.88 3.042C5.084 4.567 4.528 4 3.894 4 2.835 4 1.98 5.112 1.98 6.17c0 .086.015.17.026.254C.866 6.91.066 8.04.066 9.357c0 1.76 1.43 3.63 3.19 3.63h8.3V13h2.026v-.766h-1.745v-.694H13v.683h.92v-.683h1.03v-.347h-1.03V10h2.07zM13 9h-1.162V8H13v1zm0-1.97h-1.162V6H13v1.03zm-2.246-.368l.022-.325.39-.022L11.16 6h.33v1.03h-1.083v-.368h.347zm.715-2.732h.02v1.02h-.354l-.015-.695.37-.022-.022-.303zM9 8l1.168-.265V8h1.322v1h-.683v.09H9.065L9 8zm2.14 2h.35v1.605c-.175-.468-.322-.995-.346-1.497L11.14 10zM13 11.193h-1.162V10H13v1.193z"/></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

View File

@ -2,14 +2,15 @@
"name": "Badged",
"author": "Matthias Kretschmann <m@kretschmann.io>",
"description": "iOS Style Notification Badges for WordPress",
"version": "1.0.0",
"version": "1.0.1",
"main": "Gruntfile.js",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-imagemin": "~0.1.4",
"grunt-contrib-less": "~0.6.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-imagemin": "~0.1.4"
"grunt-svgmin": "~1.0.0"
},
"repository": {
"type": "git",