Skip to content

Resources optimizations

Said Tahsin Dane edited this page Feb 20, 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 All

You can optimize all .css and .js files in /css/ and /js/ folders by running minify_all.bat (for Windows) and minify_all.sh (for Linux and MacOS) from \automation\minifying\ folder

minify_all.bat

or

./minify_all.sh

Specify paths to .css and .js folders through parameters

For Windows:

minify_all.bat D:\development\web\zeppelin\styles D:\development\web\zeppelin\scripts

For Linux or MacOS:

./minify_all.sh ../../css ../../js

Note! path to css folder should be first

2. 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.

3. 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