sprockets

Broken precompiled assets in Rails 3.1 when deploying to a sub-URI

主宰稳场 提交于 2019-11-28 21:58:21
I'm in the process of updating a Rails 3 app to use Rails 3.1 and as part of that, am making use of the new asset pipeline. So far, I've got everything working apart from one rather annoying problem I can't solve. The application and all its assets works fine in development, but in production it is deployed to a sub-URI using Passenger ( http://the-host/sub-uri/ ). The problem with this is that the assets are pre-compiled during deployment and one of my CSS (well, it's a .css.scss file) files is making use of the image-url helper from the sass-rails gem. Since during the pre-compilation

After gem update: test fail with “Asset was not declared to be precompiled in production”

安稳与你 提交于 2019-11-28 20:50:20
问题 Since I updated several gems all tests fail with the error: ActionView::Template::Error: Asset was not declared to be precompiled in production. Add Rails.application.config.assets.precompile += %w( favicons/manifest.json.erb ) to config/initializers/assets.rb and restart your server app/views/layouts/_faviconsheader.html.erb:14:in _app_views_layouts__faviconsheader_html_erb__1320 app/views/layouts/application.html.erb:21:in _app_views_layouts_application_html_erb__4340 The error seems to

Sprockets::CircularDependencyError in Store#index

此生再无相见时 提交于 2019-11-28 19:28:51
I am following the manual Agile Web Development with Rails 4th edition and I have a problem with sprocket css in rails 3.1. The code css is: http://media.pragprog.com/titles/rails4/code/rails31/depot_e/app/assets/stylesheets/application.css.scss If I modify the css code of app/assets/stylesheets/aplication.css.scss I catch the next error: Sprockets::CircularDependencyError in Store#index Showing /home/ubuntu/Desktop/Depot/app/views/layouts/application.html.erb where line #5 raised: /home/ubuntu/Desktop/Depot/app/assets/stylesheets/application.css.scss has already been required Extracted source

What does require_self mean?

本秂侑毒 提交于 2019-11-28 17:43:26
In rails3.1 application.css we could see /* *= require_self *= require_tree . */ I know that require_tree . is just telling the system to bundle together everything from the stylesheets folder into a single file. But what does require_self tells? shedd From http://guides.rubyonrails.org/asset_pipeline.html : /* ... *= require_self *= require_tree . */ "In this example require_self is used. This will put the CSS contained within the file (if any) at the top of any other CSS in this file unless require_self is specified after another require directive. " Shedd's answer used to be correct but now

Rails 3.1 is very slow in development-mode because of assets, what to do?

笑着哭i 提交于 2019-11-28 16:50:28
After I added Sprockets, Rails is loading very slow in development mode, what should I do to speed it up? Take a look at https://github.com/wavii/rails-dev-tweaks . Rails is running all of the to_prepare hooks on every Sprockets asset request in development mode. This includes things like auto-(re)loading your code, and various gems sneak work in there too. rails-dev-tweaks disables to_prepare & reloading on any asset request (and a few others - read the first part of its README ). Speeds up your dev environment by a huge amount for any decently sized project. It's also configurable to do this

Rails asset pipeline solution for IE 4096 selector/stylesheet limit

不打扰是莪最后的温柔 提交于 2019-11-28 16:42:52
问题 The problem Microsoft's IE support documentation explains that in Internet Explorer 6-9: All style tags after the first 31 style tags are not applied. All style rules after the first 4,095 rules are not applied. On pages that uses the @import rule to continously import external style sheets that import other style sheets, style sheets that are more than three levels deep are ignored. There is a lot of evidence of this problem with script demos. See also Bless. Solution needed We need a way to

How do I use reference images in Sass when using Rails 3.1?

你离开我真会死。 提交于 2019-11-28 16:19:46
I have a Rails 3.1 project with the asset pipeline working great. The problem is that I need to reference images in my Sass, but Rails calculates image URLs. (This is particularly important in production, where Rails appends the Git hash of the image to its filename to bust caches.) For example, in app/assets/stylesheets/todos.css.scss : .button.checkable { background-image: url(/assets/tick.png); } When I deploy (or run rake assets:precompile ), the file app/assets/images/tick.png is moved to public/assets/tick-48fe85c0a.png or something similar. This breaks the CSS. This post makes two

Disable Sprockets asset caching in development

穿精又带淫゛_ 提交于 2019-11-27 21:38:06
问题 I'm using Rails 3.2.13 and the Rails Asset Pipeline. I want to use the Asset Pipeline so I can use SASS and CoffeeScript and ERB for my assets and have the Pipeline automatically compile them, so I cannot turn off the pipeline in development. I am not precompiling assets in development ever and there is not even a public/assets/ directory. However, when I make changes to an included file, such as to a _partial.html.erb file that is included (rendered) in a layout.html.erb file, without

Broken precompiled assets in Rails 3.1 when deploying to a sub-URI

感情迁移 提交于 2019-11-27 21:08:54
问题 I'm in the process of updating a Rails 3 app to use Rails 3.1 and as part of that, am making use of the new asset pipeline. So far, I've got everything working apart from one rather annoying problem I can't solve. The application and all its assets works fine in development, but in production it is deployed to a sub-URI using Passenger ( http://the-host/sub-uri/ ). The problem with this is that the assets are pre-compiled during deployment and one of my CSS (well, it's a .css.scss file) files

PhoneGap on iOS with absolute path URLs for assets?

假如想象 提交于 2019-11-27 21:08:51
Porting a web app to phoneGap on iOS, we have asset (and ajax) URLs that are absolute paths, e.g.: <img src="/img/logo.png"> We have the img directory packaged under PhoneGap's www directory. The image will not load with the absolute path, but only with a relative path, e.g.: <img src="img/logo.png"> Could someone please explain how the URL is being prefixed or translated in this context? I.e.: <img src="/www/img/logo.png"> does not work either. So what is the URL base used by PhoneGap on iOS? We've also tried, e.g.: <img src="file://img/logo.png"> <img src="file:///img/logo.png"> but no go.