[wp-trac] [WordPress Trac] #30587: SVG and PNG Images in UI Should Be Optimized

WordPress Trac noreply at wordpress.org
Wed Dec 3 22:17:04 UTC 2014


#30587: SVG and PNG Images in UI Should Be Optimized
------------------------------+-----------------------------
 Reporter:  ckoerner          |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Future Release
Component:  Build/Test Tools  |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  close             |     Focuses:
------------------------------+-----------------------------
Changes (by netweb):

 * keywords:   => close


Comment:

 Replying to [comment:2 jorbin]:
 > I think adding in [https://github.com/sindresorhus/grunt-svgmin grunt-
 svgmin] or something similar makes sense as a compliment to our current
 image minification.
 Our current `grunt-contrib-imagemin` fully supports SVG minification:

 > If I remember correctly, the reason we don't touch default themes is
 that we don't want to compress the screenshots.  This seems like something
 we can write a configuration against.
 Easy enough, see inline patch:

 {{{
 #!diff
 Index: Gruntfile.js
 ===================================================================
 --- Gruntfile.js        (revision 30594)
 +++ Gruntfile.js        (working copy)
 @@ -416,7 +416,9 @@
                                 cwd: SOURCE_DIR,
                                 src: [
 'wp-{admin,includes}/images/**/*.{png,jpg,gif,jpeg}',
 -                                       'wp-
 includes/js/tinymce/skins/wordpress/images/*.{png,jpg,gif,jpeg}'
 +                                       'wp-
 includes/js/tinymce/skins/wordpress/images/*.{png,jpg,gif,jpeg}',
 +                                       'wp-
 content/themes/twenty*/**/*.{png,jpg,gif,jpeg,svg}',
 +                                       '!wp-
 content/themes/twenty*/screenshot.png'
                                 ],
                                 dest: SOURCE_DIR
                         }

 }}}


 ----

 With all that said though, all current included themes images are fully
 optimized with a single exception:
 `src/wp-content/themes/twentyfifteen/genericons/Genericons.svg (saved 62 B
 - 0%)`

 And if I remember correctly before an included theme is shipped/released
 all images are manually optimized and committed to the repo.

 The difference between our current image optimization and the details per
 the original ticket description is the compression algorithms used by the
 different programs, we use `grunt-contrib-imagemin`:

 >> https://github.com/gruntjs/grunt-contrib-imagemin#imagemin-task
 >> Comes bundled with the following optimizers:
 >>
 >> gifsicle — Compress GIF images
 >> jpegtran — Compress JPEG images
 >> optipng — Compress PNG images
 >> pngquant — Compress PNG images
 >> svgo — Compress SVG images

 At this stage there may be some improvements by switching to another
 algorithm then we would switch to this algorithm for all images, not just
 included themes, we would also then replace the current `grunt-contrib-
 imagemin` task with the new replacement or replacements.

 Recommending this be closed and resolved as 'worksforme'

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30587#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list