sprockets

Rails 4 asset pipeline losing vendor assets

荒凉一梦 提交于 2020-01-03 08:59:30
问题 I can't seem to figure out how to make sprockets find assets in vendor/assets . I've ben been pushing off the problem by adding all of my assets to app/assets , but it's becoming way too cluttered. I have read the documentation, and tried adding all of the following lines to my application.rb file. config.assets.paths << "#{Rails.root}/vendor/assets/*" config.assets.paths << "#{Rails.root}/vendor/assets/fonts" config.assets.paths << "#{Rails.root}/vendor/assets/stylesheets" config.assets

Invalidate Sprockets cache during RSpec automated test

流过昼夜 提交于 2020-01-02 04:11:31
问题 In my Rails application, I have a .js.erb file that has a variable which gets dynamically set based on some Ruby code. var myTimer = <%= MyApp.config.timeout_time * 1000 %>; The app works fine, but I'm having a problem in some automated tests. The problem occurs in an RSpec feature test that works with this JavaScript. My spec file has a number of tests that change the ruby MyApp.config.timeout_time time on the fly to test out different scenarios. In my spec file, the first example passes,

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

sprockets loads sass in random order with twitter bootstrap

青春壹個敷衍的年華 提交于 2019-12-25 04:21:49
问题 What is the best way to enforce a certain order of sass sheets with twitter bootstrap? Reason is... Sprockets random loading of sass and bootstrap is messing up me over riding certain css properties that bootstrap set like background color. I want twitter bootstrap loaded first so I can over ride anything it sets. 回答1: Ok this method will load based on the order of imported files and will also only load the appropriate files based on the controller serving the pages. There are several things

Asset pipeline - application.js not compiled/loaded

为君一笑 提交于 2019-12-24 16:16:11
问题 I'm using rails 4 with foundation 5 and I'm having trouble getting javascript to work. Foundation's navbar menu doesn't drop down in mobile and I'm having trouble getting the jQuery datepicker to work. After a bit of searching on this site and on Google, I thought the problem might be that I was using sprockets version 2.1.2. However, after upgrading (now at version 3.3.4) the problem still hasn't been solved. I removed everthing in application.js and added a function to simple append one div

Rails 5 problems with multiple manifest files

丶灬走出姿态 提交于 2019-12-24 08:26:25
问题 thanks for your help. My Problem In my Rails 5 application I have 2 layouts, for this reason I need to set up multiple manifest files. What I have done I did the following: The two layouts have a user.html.erb and a main.html.erb html file, there I linked with the correct tags my application.js in user.html.erb and my main.js for main.html.erb . The file loads, if I follow localhost:3000/assets/application.js the full content of the js files included in the manifest is displayed, while at

Rails assets working in development and not production

荒凉一梦 提交于 2019-12-24 03:25:00
问题 the age old, "I don't understand sprockets" question; I have an asset in app/assets/javascript/jquery.fancybox.js, I use <%=javascript_include_tag('jquery.fancybox.js')%> to access/load it. this works in development, but not in production. I'm looking at the logs, but there must be something going on there, because I can't see the exact errors it's loading. Just the handlers in place (error only happens in 'production'). anways... after updating the files, I'm running "rake assets:precompile

Using twitter bootstrap with rails assets pipeline and less

假装没事ソ 提交于 2019-12-23 15:33:14
问题 How to integrate properly twitter-bootstrap-rails gem with the assets pipeline? I've followed installations steps and currently I have this application.css *= require_self *= require bootstrap_and_overrides And then in bootstrap_and_overrides.css.less I'm importing other controllers stylesheets in order to make them work with my variables defined in the overrides file and to be able to use bootstrap mixins within the controller specific stylesheets in <controller-name>.css.less files.

Require directive - file url

旧城冷巷雨未停 提交于 2019-12-23 13:16:00
问题 In Rails 3 (Sprocket), is there a way to load a javascript file using a url to a remote site? For example, I want something similar to this in your .js file using the require directive, //= require http://example.com/remote_file.js 回答1: No. You can only require files that are inside your application or in gems that your application depend on. See http://guides.rubyonrails.org/asset_pipeline.html#asset-organization and http://guides.rubyonrails.org/asset_pipeline.html#adding-assets-to-your