AssetNotPrecompiledError for missing assets - really?

41 views
Skip to first unread message

Pascal Friederich

unread,
Jan 29, 2012, 1:30:10 PM1/29/12
to Ruby on Rails: Talk
I migrated one of my projects to from Rails 3.0 to 3.2.1 which means
I'm using the asset pipeline for the first time.
As much as I like the ease of compressing and minifying my assets the
more I'm annoyed about its behavior to raise an
AssetNotPrecompiledError as soon as, well, there's an asset that's not
precompiled.

Can somebody explain me the reason why this is considered to be a good
idea?
For something as trivial as a missing image file the app fails
completely instead of just falling back to "old style" image_tag
behavior (images/foo.png vs assets/foo.png) and maybe produce an error
log line. Even a missing js or css file
isn't necessarily a showstopper. At least the app would still be
usable for a user until the "problem" gets fixed.

I just cant see the benefit of this new behavior.

What am I missing out here?

cheers

Peter Vandenabeele

unread,
Jan 29, 2012, 2:02:49 PM1/29/12
to rubyonra...@googlegroups.com
Maybe this option can help you:

   # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false


It's off (false) by default, but if you wanted you could turn it on.

In that case, you probably need to make this group
in your Gemfile

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'uglifier'
  gem 'bootstrap-sass'
end

also available in production (which would mean to put it
outside of the :assets group).

HTH,

Peter
Reply all
Reply to author
Forward
0 new messages