asset-pipeline

Rails 4 link_to larger, static image

两盒软妹~` 提交于 2020-01-02 08:14:31
问题 My files are stored in app/assets/images/subdirectory/image.png and app/assets/images/subdirectory/image_full.png . In my app/views/home.html.erb : <%= link_to (image_tag("subdirectory/image.png"), asset_path("subdirectory/image_full.png")) %> I've also tried: <%= link_to (image_tag("subdirectory/image.png"), asset_path("subdirectory/image_full.png", image)) %> <%= link_to (image_tag("subdirectory/image.png"), image_path("subdirectory/image.png", image)) %> Couldn't find much via the docs:

Rails assets:precompile only one asset?

北城余情 提交于 2020-01-02 06:35:32
问题 Currently we have a Rails application but I have one question regarding the assets precompilation. Each time that I edit one file (stylesheet or javascript file), we have to run: bundle exec rake assets:precompile ...and then upload everything again, even those files that didn't changed at all. Is there a way to compile only the edited files and the manifest.yml file? Thanks in advance. 回答1: i also had such a question, googled a lot and found one gem called: guard-rails-assets It compiles the

Grails Asset-pipeline does not load angular partial templates

拜拜、爱过 提交于 2020-01-02 03:25:08
问题 Im using angular-ui-bootstrap with Grails 2.3.x asset-pipeline:1.6.1 plugin. One of the components - alert.js is attempting to load /template/alert/alert.html but this resolves to 404. I tried including grails.assets.includes=[* / .html], did not help. Any workaround for this? Anyway to let asset-pipeline include partial templates? 回答1: Is template located in assets, if so remember the first level folders inside of assets are flattened so you may want to nest your templates one more level or

rails config.assets.precompile for specific sub folder

ε祈祈猫儿з 提交于 2020-01-02 01:25:07
问题 Ive some very heavy external stylesheets in app/assets/stylesheets/external/calendars I dont want to include the stylesheets into the application.css as they are used infrequently Yet i want them precompiled. Ho w do i use config.assets.precompile o selectively precompile all stylesheets nside this folder ? 回答1: This is covered in section 4.1 of the Asset Pipeline Rails Guide config.assets.precompile += ["*external/calendars*"] 回答2: You can simple write it like this: config.assets.precompile

What is the best place to store static assets (files) in rails 3.1 ( pdf forms, xls files, etc)

佐手、 提交于 2020-01-02 01:14:10
问题 I have a bunch of static assets ( not jpg, css, & js) - rather files like pdf forms, xls that I need to serve to users. They rarely change. Before I used to store them in public folder, but with the introduction of the assets pipeline in rails 3.1 what is the best place to store files like that now now? thanks 回答1: Actually I just tested it by creating a folder in app/assets/files and sticking my xls files in there, and rake assets:precompile task just picked it up. Also this needs to be

Rails path-helpers doesn't work in js.coffee.erb

牧云@^-^@ 提交于 2020-01-01 10:02:44
问题 In my Rails 3.2 app (Ruby 1.9) I get following error when using path helpers in Coffeescript. undefined local variable or method `new_user_session_path' In my partial _usermenu.html.haml that works fine: = link_to t('user.login'), new_user_session_path In my app/assets/javascripts/metamenu.js.coffee.erb that throws above error: $.get("<%= new_user_session_path %>") Isn't it possible to use x_path and x_url helpers in coffeescript erb's? 回答1: This is because you are not within the view context

Serving assets is very slow in development

半世苍凉 提交于 2020-01-01 06:34:04
问题 I have a standart rails 3 webapp with the default asset pipeline. All of a sudden, the assets took a very long time to load (my page loads went to ~1-2secs to ~1min). The server response time (/home) is normal, but some .css and .js files are pending for very long (up to 45 seconds). The only few assets that take this long are those provided by gems (eg: modernizr-rails/vendor/assets/javascripts/modernizr.js ) For example, for modernizr.js?body=1 : Headers: Request URL:http://dev.sharewizz

Rails 3.1 with Asset Pipeline, link_to :confirm message showing twice?

雨燕双飞 提交于 2020-01-01 04:07:05
问题 Okay, so I've seen this question about this problem being caused by multiple linkings of jQuery or Prototype, but I can confirm that I'm only linking to jQuery once on the entire page. My problem is this: when I have a link_to that confirms a deletion, the popup shows twice. Here's the applicable code in my template (written in Slim): link_to('Destroy', depot_path(@depot.id), :confirm => "Really?", :method => :delete) I'm running Rails 3.1.0 with the Asset Pipeline turned on, with gem 'jquery

Rails include javascripts assets folder recursively

谁说胖子不能爱 提交于 2020-01-01 03:58:08
问题 I understand how to add one javascript file to rails assets pipeline. Just add //= require filename to application.js But how can I include many javscripts files under one folder vendor/assets/javascripts/<js_library> Or I have to list them all explicitly ? 回答1: //= require_tree . will require everything in the current directory of your application.js //= require_tree ./js_library will require everything in the js_library subdirectory if it is under app/assets/javascripts If you are are

How to use Galleria plugin with Rails 4 Pipeline

我怕爱的太早我们不能终老 提交于 2020-01-01 03:21:53
问题 I've recently had a trouble making Galleria plugin work with Rails 4 Pipeline and it took me a while to figure out how to make it work, so I wanted to share the solution in case somebody has the similar problem. 1) After downloading the plugin, put galleria-1.3.3.js ( it's the current version on the day I write it ) and galleria.classic.js ( or other style js file ) to vendor/assets/javascripts 2) Put galleria.classic.css ( or other theme stylesheet) to vendor/assets/stylesheets 3)Add //=