forked from idearise/themes_for_rails
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare code for asset pipeline. refs lucasefe#54
* check for asset digest and store in TFR config * If asset pipeline, use theme_assets_dir config and PREPEND to config.asset.paths. This requires theme assets to be in a folder under the theme_name so as not to clobber other themes. * When gathering digested assets, fallback to the original asset if no digested one is available
- Loading branch information
Showing
4 changed files
with
37 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,24 +44,24 @@ def add_theme_view_path_for(name) | |
end | ||
|
||
def digest_for_image(asset, theme_context) | ||
if Rails.application.config.respond_to?('assets') && Rails.application.config.assets.digests | ||
File.basename(Rails.application.config.assets.digests["#{theme_context}/images/#{asset}"]) | ||
if ThemesForRails.config.asset_digests_enabled? | ||
Rails.application.config.assets.digests["#{theme_context}/images/#{asset}"] || asset | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jasherai
Author
Owner
|
||
else | ||
asset | ||
end | ||
end | ||
|
||
def digest_for_javascript(asset, theme_context) | ||
if Rails.application.config.respond_to?('assets') && Rails.application.config.assets.digests | ||
File.basename(Rails.application.config.assets.digests["#{theme_context}/javascripts/#{asset}"]) | ||
if ThemesForRails.config.asset_digests_enabled? | ||
Rails.application.config.assets.digests["#{theme_context}/javascripts/#{asset}"] || asset | ||
else | ||
asset | ||
end | ||
end | ||
|
||
def digest_for_stylesheet(asset, theme_context) | ||
if Rails.application.config.respond_to?('assets') && Rails.application.config.assets.digests | ||
File.basename(Rails.application.config.assets.digests["#{theme_context}/stylesheets/#{asset}"]) | ||
if ThemesForRails.config.asset_digests_enabled? | ||
Rails.application.config.assets.digests["#{theme_context}/stylesheets/#{asset}"] || asset | ||
else | ||
asset | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hi there. im getting errors w/ Rails.application.config.assets.digests being nil. any ideas? i have asset_digests_enabled set to true and am including the gem within the assets group, thanks!