Skip to content

Resources optimizations

Oleh Zasadnyy edited this page Feb 22, 2015 · 5 revisions

Images

####For Windows You can optimize images by running all_image_optimization.bat from \automation\images\ folder

all_image_optimization.bat -d -jtran -pout -pquant -optip -gsicle -svgo

Parameters:

For -svgo intall Nodejs and then run command

[sudo] npm install -g svgo

You can use some of parameters. For example

all_image_optimization.bat -d -jtran -optip

Moreover, you can run the files separately jpegtran.bat, pngout.bat, optipng.bat, pngquant.bat, gifsicle.bat or svgo.bat which by default will optimize all images in /img/ folder and subfolder or pass a path to the folder.

jpegtran.bat 

Or

jpegtran.bat D:\development\web\zeppelin\images

####For MacOS and Linux

  • Mac OS users available amazing tool - imageoptim. Thanks @raphaelsavina for link.

  • The other option is this command line utility which is based on ImageOoptim.app and can be used in Linux and MacOS. I can be installed like this:

gem install image_optim

More information about installation and usage can be found on its website: https://github.com/toy/image_optim It uses almost the same utilities for the mentioned ones for Windows.

Minify CSS and JS

1. Optimize CSS and JS separately

You can also run the files separately minify_css.bat (minify_css.sh) or minify_js.bat (minify_js.sh) You can use some of them.

For Windows:

minify_css.bat 
minify_css.bat D:\development\web\zeppelin\styles

For Linux or MacOS:

./minify_css.sh
./minify_css.sh ../../css

Note: When the folder is not specified, the default css and js folders will be used.

2. Only minify default CSS and JS files.

Also you can generate .min files only of main.css and scripts.js

minify_main_css.bat
minify_scripts_js.bat