asset-pipeline

Disabling asset fingerprinting with asset_path for a single asset

喜夏-厌秋 提交于 2019-12-04 17:52:04
问题 I want to use the normal asset name, e.g. app.js when calling the asset_path helper in my views. In production, it uses the cache-busting name, e.g. app-f73cf13e6f100eda6681381e7d3ae9eb.js . Is there a way to get the normal name using asset_path ? 回答1: Figured it out, pretty simple actually. Just have to add digest: false to asset_path like so: asset_path('app.js', digest: false) 回答2: By default assets.digest is enable in production environment and is recommended for several reasons. However,

Rails 3.1 asset urls in SCSS files do not seem to be referencing the assets correctly

余生长醉 提交于 2019-12-04 17:23:15
I just upgraded from Rails 3.0 to Rails 3.1. I have a foo.css.scss file that references an image ( /app/assets/images/foo.png ) as follows: .foo { background-image: image-url('foo.png'); } The problem is that my foo.png file is not loaded and I see 404 errors in my logs. The actual css entry that is generated is: background-image: url(/images/foo.png); which is wrong (?) because the image can be found at /assets/foo.png and not at /images/foo.png . Note that I am still working on development mode. Another important note. If I rename my foo.css.scss file to foo.css.erb and use: background-image

Asset Pipeline: Trouble on deploying my Rails 3.1 application with Capistrano

倾然丶 夕夏残阳落幕 提交于 2019-12-04 17:11:08
I am using Ruby on Rails 3.1.0 and Capistrano. I have a problem on make the application to work in production mode (the remote machine is running Ubuntu 10.4 - my local machine is a MacOS running Snow Leopard 10.6.7). When I deploy with Capistrano I get this error: uninitialized constant Rake::DSL When I try to access a web page I get this error: ActionView::Template::Error (application.css isn't precompiled) What I should to do in order to make the application to work in production mode on the remote machine? In my Capfile file I have: # Uncomment if you are using Rails' asset pipeline load

Rails with Twitter Bootstrap: still serving an old asset

泄露秘密 提交于 2019-12-04 17:03:54
问题 Going nuts here. I'm developing a rails app, and I'm using the twitter-bootstrap-rails gem in order to include the Twitter Bootstrap styles in my app. This gem generates a file called 'bootstrap_and_overrides.css.less' in app/assets/stylesheets, which I have been using to modify some of the bootstrap variables and include my own CSS overrides. Everything has been working fine until today. For some reason, the changes I am making to this file today are getting saved to the file, but Rails is

Heroku ActionView::Template::Error eof (undefined) in /app/app/assets/javascripts/application.js

不问归期 提交于 2019-12-04 15:48:35
I deployed my app to Heroku. I am having this error in the log : ActionView::Template::Error (Unexpected token: eof (undefined) (in /app/app/assets/javascripts/application.js)): : 3: <head> : 4: <title>wkkin</title> : 5: <%= stylesheet_link_tag "application" %> : GET xxx.herokuapp.com/users/2/edit dyno=web.1 queue=0 wait=0ms service=1 292ms status=500 bytes=728 : 6: <%= javascript_include_tag "application" %> : 7: <%= csrf_meta_tags %> : 8: </head> : 9: <body> : app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___1096119453842232088_43006600' My application

Dependency included in gemspec not added to asset pipeline in rails engine

白昼怎懂夜的黑 提交于 2019-12-04 15:48:25
问题 I'm writing a rails engine that has some dependencies. I've specified the dependencies in the gemspec and the engine is finding them when I run bundle install (i.e. Gemfile.lock looks correct). When I want to use the plugin in a Ruby file, I can do so but need to explicitly require dependency-name at the top of the file. However, when I want to use the dependency's asset pipeline, sprockets can't find it. The app I'm using (for now) is the dummy app that comes in a rails plugin's test folder.

ruby on rails 3.1 move .swf to asset pipeline?

断了今生、忘了曾经 提交于 2019-12-04 15:35:19
问题 Is it possible to move SWF files to the asset pipeline, and if possible how can this be done? 回答1: I would recommend putting them in a folder called app/assets/flash . Add this folder to your asset paths: config.assets.paths << Rails.root.join('app', 'assets', 'flash') They can be referenced like this in your views: asset_path('name_of_swf') The asset_path helper will ensure the correct file is referenced in development and production modes. 来源: https://stackoverflow.com/questions/8990393

Static pages and assets in Rails 3.1.1

一曲冷凌霜 提交于 2019-12-04 15:11:10
问题 Currently working on a project where we need to drop in various static html pages + static assets for those from time to time that "just work." We cannot have anyone editing the html directly to place paths in for the assets. We need it to simply work such that the html + asset folders are placed directly into /public and the content is served up as it was generated. When testing this behavior in production, it's a no go with errors such as: ActionController::RoutingError (No route matches

loading order JavaScript files in asset pipeline

拟墨画扇 提交于 2019-12-04 14:44:38
I am using a Rails 4 application. I installed some JavaScript plugin files in "vendor/assets/javascripts", and some in "app/assets/javascripts" where I have some files that are invoking methods from the vendor files. No methods from these are recognized and it seems that "app/assets/javascripts" files are loaded before "vendor/assets/javascripts" files. How can I deal with that? For information my "application.js" calls: //= require jquery //= require jquery_ujs //= require turbolinks //= require rails.validations //= require_tree . and I am using gem 'jquery-rails' . mr rogers Any files in

Serving images from public folder when using asset pipeline Rails 3.2

混江龙づ霸主 提交于 2019-12-04 14:42:19
I am using Rails 3.2 asset pipeline to serve my assets(images, javascript. css). I have added paperclip for photo uploads. paperclip by default stores files in public/system When I use the url generated by paperclip which is something like /system/users/avatar/000/000/thumb/whatever.jpg It gives me no route error. the file is there at the above location but I think it may be issue with asset pipleline. Any ideas what might be going wrong ? just like user451893 said. you should configure your web-server (nginx, apache etc) to deliver all static assets! in case you don't, then you need to turn