Adam Wong
2013-Feb-26 19:09 UTC
Is it possible to execute a ruby script in the asset pipeline?
I''m working on an idea and I was wondering if it was even possible... We are frequentlly tweaking images as the style of our website changes. Usually we need to slightly alter the color of a layer in the image so that it matches our css. This means editing an image in photoshop, making the change and then exporting to jpeg. This process gets old very fast. What I''d like to do is to save those images in a raw format and precompile them in the same way I precompile my other assets. Example:* logo.jpeg.rb* precompiles to *logo.jpeg*, where the logo.jpeg.rb is a ruby script that modifies a layered image file _logo.tiff (or perhaps _logo.psd) using RMagick. In this example, _logo.tiff is the "raw" image, logo.jpeg.rb is the script which processes _logo.tiff and which is replaced by logo.jpeg after pre compilation. The end result is a dynamic image- a logo whose colors change to match our css. Is this even possible? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/AofCcmEtrKsJ. For more options, visit https://groups.google.com/groups/opt_out.
Ronald Chan
2013-Feb-27 06:23 UTC
Re: Is it possible to execute a ruby script in the asset pipeline?
I know at least you can use .erb, because I have made a *.js.erb file before. Ronald On Wednesday, February 27, 2013 8:09:05 AM UTC+13, Adam Wong wrote:> > I''m working on an idea and I was wondering if it was even possible... > > We are frequentlly tweaking images as the style of our website changes. > Usually we need to slightly alter the color of a layer in the image so that > it matches our css. This means editing an image in photoshop, making the > change and then exporting to jpeg. This process gets old very fast. What > I''d like to do is to save those images in a raw format and precompile them > in the same way I precompile my other assets. > > Example:* logo.jpeg.rb* precompiles to *logo.jpeg*, where the > logo.jpeg.rb is a ruby script that modifies a layered image file _logo.tiff > (or perhaps _logo.psd) using RMagick. In this example, _logo.tiff is the > "raw" image, logo.jpeg.rb is the script which processes _logo.tiff and > which is replaced by logo.jpeg after pre compilation. The end result is a > dynamic image- a logo whose colors change to match our css. > > Is this even possible? >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/xArBY2vyV50J. For more options, visit https://groups.google.com/groups/opt_out.
Frederick Cheung
2013-Feb-27 07:28 UTC
Re: Is it possible to execute a ruby script in the asset pipeline?
On Tuesday, February 26, 2013 7:09:05 PM UTC, Adam Wong wrote:> > I''m working on an idea and I was wondering if it was even possible... > > We are frequentlly tweaking images as the style of our website changes. > Usually we need to slightly alter the color of a layer in the image so that > it matches our css. This means editing an image in photoshop, making the > change and then exporting to jpeg. This process gets old very fast. What > I''d like to do is to save those images in a raw format and precompile them > in the same way I precompile my other assets. > > Example:* logo.jpeg.rb* precompiles to *logo.jpeg*, where the > logo.jpeg.rb is a ruby script that modifies a layered image file _logo.tiff > (or perhaps _logo.psd) using RMagick. In this example, _logo.tiff is the > "raw" image, logo.jpeg.rb is the script which processes _logo.tiff and > which is replaced by logo.jpeg after pre compilation. The end result is a > dynamic image- a logo whose colors change to match our css. > > Is this even possible? >I''m not sure exactly how, but given that you can add pipeline items to compress css, run pngcrush on images etc, I would have thought you could define your own processing which would do the image transformation you require. Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/cYR41adLzdwJ. For more options, visit https://groups.google.com/groups/opt_out.