asset-pipeline

Rails 4 link_to larger, static image

天大地大妈咪最大 提交于 2019-12-06 00:42:42
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: http://guides.rubyonrails.org/asset_pipeline.html But it totally crashes my app when I attempt to load

Assets path issue with S3

徘徊边缘 提交于 2019-12-05 22:19:30
In production, I use Heroku and dynamic assets on S3. It works fine. Now I try to send my statics assets to S3. I followed this tutorial https://devcenter.heroku.com/articles/cdn-asset-host-rails31 I added asset_sync gem, I configured my heroku ENVs, my config/production.rb and I run heroku run rake assets:precompile It seems to work fine : Using: Directory Search of /app/public/assets Uploading: assets/application.js.gz Uploading: assets/application.css Uploading: assets/application-8977252f192f3e36dbd6b5142de920e3.css.gz Uploading: assets/eurof35-webfont-4ea19cda003d589e688cedcf9f79ddd6.eot

Remove development gems from production with Bundler and Rails 4

做~自己de王妃 提交于 2019-12-05 21:45:20
Problem Our deployed application has development dependencies in it. We have a lot of development dependencies. This increases the artifact size and the memory consumption in production, as all those dependencies are require 'd. Most instances are deployed in the cloud, so more memory = more money for larger instances. We would like to reduce the size/memory and make a more clear separation between the deployed artifact and the development environment. A particular focus is the need for therubyrhino in production environments even though our assets are precompiled. Context This question has

Rails 3.1 asset pipeline vendor/assets folder organization

隐身守侯 提交于 2019-12-05 20:18:43
问题 I'm using the jQuery Tools scrollable library in my Rails 3.1 site with the various assets placed in the vendor/assets folder and it works great. My question is regarding the best way to organize the various files under vendor/assets. What is the recommended way to organize vendor/assets subfolders? Currently I have this structure: vendor/assets/ |-- images/ | |-- scrollable/ | <various button/gradient images> |-- javascripts/ | |-- scrollable/ | jquery.tools.min.js |-- stylesheets/ | |--

Why won't my css changes show without me restarting WEBrick?

孤街浪徒 提交于 2019-12-05 18:39:07
I am doing some simple css edits on a rails 3.2 project and my changes will not show up unless I restart webrick. I came across something saying that it may be using the public/assets directory, but I don't think this is the case because my changes show when the server is restarted. Not sure why this is happening. Does anyone know if there is some sort of configuration that I need to fix to solve this problem? bundle exec rake assets:clean run this command I added this to my development.rb file and now it works. config.assets.digest = false 来源: https://stackoverflow.com/questions/14559615/why

Determining which assets are not being used in Rails?

流过昼夜 提交于 2019-12-05 18:38:34
I'm using the asset pipeline in Rails and we have many haml partials that some are probably not used, along with unused images. How do you work out if an asset is not being used, e.g. images, haml, etc.? Is there an automated way to find out? I found some links but haven't tried them yet. I will report back when I get a chance to try them out: discover-unused-partials A script to help you finding out unused partials . Good for big projects or projects under heavy refactoring. Covers Haml and ERB. deadweight Deadweight is a CSS coverage tool. Given a set of stylesheets and a set of URLs, it

Rails assets:precompile only one asset?

微笑、不失礼 提交于 2019-12-05 18:23:59
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. Said Kaldybaev i also had such a question, googled a lot and found one gem called: guard-rails-assets It compiles the assets within Rails 3.1 application whenever those change. For example, you can do this: #

rake assets:precompile is slooooow. Any way to speed it up?

喜你入骨 提交于 2019-12-05 18:20:57
I have a Rails 3.2 app running on Heroku, and it uses CKEditor. Now, CKEditor is a pretty large collection of files and folders, and is probably the biggest contributor to the time it takes to precompile assets. A regular push to Heroku takes well over a minute on the assets:precompile step. So I now precompile locally, and only when I've made edits, before I push to Heroku, to shorten deploy times. However, my poor old Windows laptop easily breaks 15 minutes for rake assets:precompile. This makes it a huge pain to make minor edits or additions to js or css files. I do have config.assets

javascript functions available via javascript_include_tag but not asset pipeline and application.js

拈花ヽ惹草 提交于 2019-12-05 18:07:16
My apologies if this has been posted somewhere else, but I'm not exactly sure how to even phrase a search for this problem. Basically, I've got fullcalendar.js sitting in app/assets/javascripts/ . Within my application.js file (in the same folder of course) I've got the following... //= require jquery //= require jquery_ujs //= require foundation //= require_tree . So, as expected the fullcalender.js gets swept up in the asset compiling process and ends up in the application.js that is then served to the user. The problem comes in when I try to reference a function defined in fullcalendar.js

Why is assets:precompile so slow on Heroku?

折月煮酒 提交于 2019-12-05 14:19:16
My deployment set up is to have Heroku precompile assets. I want them precompiled so I can send them to a CDN (via asset_sync ) and I want that done on Heroku so I don't have any compiled assets in my repo. I set that up using Heroku's guide and that had been working great. I added turbo-sprockets-rails3 for a speed boost. It had all been working fine and then stopped; I can't figure out why. Now when I deploy (without public/assets ) the assets:precompile Rake task times out on Heroku. To see how long it's really taking, I went into a shell ( heroku run bash ): ~ $ time bundle exec rake