GithubHelp home page GithubHelp logo

valerijaspasojevic / jekyll-compress-images Goto Github PK

View Code? Open in Web Editor NEW
40.0 3.0 3.0 19 KB

๐Ÿš€ Jekyll plugin for compress/optimize images (jpg, png, gif, svg)

License: MIT License

Ruby 100.00%
jekyll optimize-images compress-images images

jekyll-compress-images's Introduction

Gem Version

jekyll-compress-images

Plugin for compress/optimize images (jpg, png, gif, svg).

Installation

add to your Gemfile:

gem 'jekyll-compress-images'

and in _config.yml:

plugins:
  - jekyll-compress-images

Run bundle install in your project folder

Configuration

If you want to setup different path for images, open _config.yml add

compress_images:
  images_path: "yourpath/img/**/*.{gif,png,jpg,jpeg,svg}"

if you don't configure your default path will be assets/img/**/*.{gif,png,jpg,jpeg,svg}

image_optim options

You can pass image_optim options by using

imageoptim:
  pngout: false
  svgo: true
  verbose: false

Usage

on jekyll serve or in jekyll build you will run compression, if your images are already compressed, you don't need to worry because it will not run again which will save bunch of time! :)

If this project helps you, you can give me a robot instead of coffee. :)

paypal

Enjoy ๐ŸŽ‰

jekyll-compress-images's People

Contributors

brototyp avatar valerijaspasojevic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jekyll-compress-images's Issues

svgo worker not found

Received the following error when launching jekyll using the plugin:

svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)

In my _config.yml:

# Plugins
plugins:
  - jekyll-compress-images

imageoptim:
  # Disabling svgo because it throws some error
  svgo: false
  jpegrecompress:
    allow_lossy: true
    quality: 2
    # max_quality: 80

Not sure why svgo worker is being triggered when its specifically disabled in the config.

Add hash to cache?

Would it be of any use to anyone if there were a hash of the image file in _compress_images_cache.yml?

This would mean that if an image changed (perhaps you edited it in photoshop) it would be re-optimised.

Regenerating cache file repeatedly with jekyll serve

Hi, I'm using latest master branch code for the plugin, jekyll version 3.7.4, ruby version ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]

config.xml options

compress_images:
  images_path: "uploads/*.{gif,png,jpg,jpeg,svg}"
  
imageoptim:
  svgo: false
  verbose: false

Using jekyll serve, when there is a change in any other file and after jekyll serve attempts to regenerate that file, it starts keep regenerating cache file and never stops.

I see endless messages like below.

      Regenerating: 1 file(s) changed at 2019-04-25 16:54:20
                    _compress_images_cache.yml
                    ...done in 0.566471 seconds.
                    
      Regenerating: 1 file(s) changed at 2019-04-25 16:54:21
                    _compress_images_cache.yml
                    ...done in 0.547225 seconds.
                    
      Regenerating: 1 file(s) changed at 2019-04-25 16:54:22
                    _compress_images_cache.yml

Don't overwrite the original image file

I'd prefer if the image optimization would dump the optimized images into _site without touching the original images. For example, I want to store high-quality images in the repo and then compress them only when serving.

images not resized on localhost

it's weird: first time when I installed plugin Jekyll took some time to build site while shell was writing me this image is optimized other image is optimized and so on.
When I stopped server (ctrl C) and run again (Bundle exec jekyll serve) the build process was faster and nothing about optimization images appears on the shell.

In my _site/images folder (on local) the images has the same original size. But if I retrieve images from my site, published on github pages, the images seem to be smaller. I told it seems because Google Page Speed Insight tell me that the images are not optimized and have the same previous size.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.