asset-pipeline

Rails Assets Precompile just not working

对着背影说爱祢 提交于 2019-12-29 06:46:29
问题 I've pushed a Rails app to Heroku and keep on running into the following problem: I'll save changes to my main css.scss file (in assets/stylesheets) or to images in assets/images, push to git, push that to heroku, and reload the page, only to find out that these assets haven't been loaded at all. This was also a slight problem on the local server, but entering: rake assets:precompile and reloading the local server usually worked, whereas doing heroku run rake assets:precompile and then re

Slow assets ruby 1.9.3, macos, rails 3.2

霸气de小男生 提交于 2019-12-29 06:21:27
问题 Im have a really weird issue, my assets served really slow in development(10 sec per file), thia happens only in Chrome(17.0.963.79). In Firefox all works just fine. My setup: RVM Ruby-1.9.3@p125 Rails 3.2.0 Mac OS 10.7.3 I have tried switch from webrick to mongrel and thin , using rails-dev-tweaks gem , set cache classes to true and false. All this didnt help, im stuck why it's work slow only in chrome and not in firefox? Also this is fresh setup of OS, maybe im missing something, thanks!

How do I prevent Rails 3.1 from caching static assets to Rails.cache?

拜拜、爱过 提交于 2019-12-29 04:35:10
问题 I'm using CloudFlare CDN on my Rails 3.1 application. Cloudflare is a CDN that works at the DNS level. On the first hit to a static asset, CloudFlare loads it from your app then caches it in their CDN. Future requests for that asset load from the CDN instead of your app. The problem I'm having is that if you set controller caching to true: config.action_controller.perform_caching = true it enables the Rack::Cache middleware. Since Rails sets a default cache control setting for static assets,

Rails 4: How do I create a custom 404 page that uses the asset pipeline?

依然范特西╮ 提交于 2019-12-29 03:19:31
问题 There are many solutions for creating customized error handling pages, but almost none for Rails 4: Basic Rails 404 Error Page Dynamic error pages in Rails The standard answer of encouraging people to modify 404.html in /public doesn't work for me because I want to use the CSS theme that resides in the asset pipeline. Is there a way that html files can access those styles defined in the asset pipeline? If not, is there a way to create a custom error handler that has access to the pipeline?

rails 4 asset pipeline vendor assets images are not being precompiled

余生长醉 提交于 2019-12-28 04:59:27
问题 I'm using rails 4 & ruby 1.9.3 for my application and fancybox2-rails gem, but there's a general problem with asset pipeline. If I run rake task for precompile, then everything is fine except for images in vendor/assets/images and ../gems/ruby-1.9.3-p327/gems/fancybox2-rails-0.2.1/vendor/assets/images . Images from these two folders are not being precompiled and eventually I have a problem with dead links to non-existing images. Any suggestions? 回答1: It seems like images are included by

Using a Rails helper method within a javascript asset

吃可爱长大的小学妹 提交于 2019-12-27 16:39:13
问题 Is there any way to use a Rails helper method, more specifically, a path helper method within a javascript asset file. This file foo.js.coffee.erb $('#bar').val("<%= create_post_path %>") I would love it if I could get from erubis $('#bar').val("path/to/create") 回答1: You can include any helper/module/class in an erb template with: <% environment.context_class.instance_eval { include MyHelper } %> See: https://github.com/rails/sprockets/blob/master/lib/sprockets/environment.rb and https:/

Using asset-pipeline in Rails 3.0

社会主义新天地 提交于 2019-12-25 08:23:41
问题 How do I go about configuring my application to use the asset pipeline in Rails 3.0? Pointers to any blogs/tutorials would be much appreciated. 回答1: The asset pipeline is effectively sprockets, so for Rails 3.0: https://gist.github.com/980056 回答2: Take a look at https://github.com/jamesmacaulay/sprockets_rails3_backport - exactly what you need. 来源: https://stackoverflow.com/questions/8986312/using-asset-pipeline-in-rails-3-0

Rails erb preprocessing not happening in development mode

こ雲淡風輕ζ 提交于 2019-12-25 07:38:10
问题 For whatever reason, this first attempt at dynamic styling gets me a Sass::SyntaxError on the line below. It looks like the erb is not being pre-processed. /* app/assets/stylesheets/variables.css.scss.erb */ $headerHeight: <%= '15px' %>; It's in development mode. Any idea what could cause this? Here are my configuration options relating to assets in case that helps: # Application config.assets.enabled = true config.assets.initialize_on_precompile = true config.assets.version = '1.1' #

Correct use of non-stupid-digest-assets gem

我的梦境 提交于 2019-12-25 01:54:21
问题 Even though it is a very, very simple gem, I believe I don't understand the idea behind non-stupid-digest-assets (https://github.com/alexspeller/non-stupid-digest-assets) since it isn`t working on my app. I need to use CKEDITOR on my app, but the rails digest is messing everything up. I added this to config/initializers/non_digest_assets.rb: NonStupidDigestAssets.whitelist = [/ckeditor\/.*/] But my ckeditor files still don't show up. Could someone help me? 回答1: As a starting point of

My CSS is loading differently between development and production environments

我只是一个虾纸丫 提交于 2019-12-25 01:43:53
问题 I can not quite figure out why my Rails app is displaying differently between production and development environments. I have confirmed that the same CSS files are being loaded between my local host and heroku app. There are several subtle differences. Containers aren't showing up the same size, text is showing up bigger than it should, weird things like that. I am not sure what is causing the differences. This is an example of inspecting the same container in the two different environments: