Comments (8)
Please look at #31 by @bencrouse it allows to set options for image_optim in rails app config, it is already merged, but not yet released.
from image_optim.
@toy , Thanks for your answer but actually #31 make it possible to config ImageOptim for Rails assets pipeline only, it is not used in other context.
The need of writing a yaml file for the config make it hardly feasible to share a config between several application or when developing a gem.
from image_optim.
You could write your own config/image_optim.yml and do something like this to load it:
IMAGE_OPTIM_CONFIG = YAML.load_file(Rails.root.join('config', 'image_optim.yml')[Rails.env]
config.assets.image_optim = IMAGE_OPTIM_CONFIG
and then where ever else you wanted to use image_optim...
io = ImageOptim.new(IMAGE_OPTIM_CONFIG)
from image_optim.
@bencrouse , thanks for your suggestion, I will use it from now.
I would still be in favor of adding this directly in this gem in order to avoid having to specify default option everywhere we use ImageOptim.new
but not a big deal neither, please close if you feel like it's not wanted for now.
from image_optim.
I think ideally, I'd like to see a ImageOptim.defaults
config option where you could 1) find out the out of the box defaults 2) change them for all instances of ImageOptim.
ImageOptim#initialize
would then be responsible for merging whatever options are sent into that instance with whatever is in ImageOptim.defaults
.
I may take a stab at it if @toy likes the idea and I have some free dev time this week.
from image_optim.
@bencrouse , seems like a perfect answer to my needs.
from image_optim.
@bencrouse @bobbus Better to put it into ImageOptim::Config
.
defaults
sounds like it should be overridable by global and local configs. It is a good thing that it will be possible to read defaults, but it will not be possible to override global/local config. Ideas?
from image_optim.
+1 for rails initializer idea
from image_optim.
Related Issues (20)
- incompatible character encodings: UTF-8 and ASCII-8BIT HOT 9
- GPU vs CPU HOT 3
- Extended attribute status already compressed files HOT 4
- [Feature Request] an option to keep tags and comments when optimizing
- `advpng` installed on ubuntu, or OS X via homebrew, _does not_ have a proper version number HOT 14
- Consider OxiPng instead of OptiPNG HOT 2
- Support guetzli
- Specify a temp directory for the temporary files HOT 9
- Invalid cross-device link HOT 10
- After #optimize_image! the image is rotated HOT 1
- Req: Print only the list of optimized images HOT 2
- what are the permissions for here? HOT 3
- jpegoptim worker didn't strip comment HOT 2
- Add support for SVGo 2.x HOT 7
- Work as a pipe
- Don't overwrite by default
- Support webp
- Cannot load YAML config file that uses Range class in Ruby 3.1.x / Psych4.x HOT 2
- Ruby 3.2.0 / Rails 7.0.4 invalid byte sequence in UTF-8 (ArgumentError) HOT 4
- Cannot allocate memory - grep HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image_optim.