sprockets

Rails asset pipeline: Standard way for including all /vendor/assets/javascripts/?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 18:06:05
I've been transitioning an app to Rails 3.1 (and now on to 3.2) and watched the Railscast on the asset pipeline . I moved all of my third-party jquery plugin files to the /vendor/assets/javascripts/ directory. In my /app/assets/javascripts/application.js I have the following: //= require jquery //= require jquery_ujs //= require_tree . //= require_self I realized the require_tree . call only loads the tree for the /app/assets/javascripts/ directory. (Is that correct?) What's the best way to include all the "vendor" javascripts? (I'm not worried about ordering at this point.) Of course I could

Disable Asset Pipeline/Sprockets Rails 4.1

帅比萌擦擦* 提交于 2019-11-27 17:17:45
问题 I cannot seem to find a way to disable the Asset Pipeline in Rails 4.1. I see a lot of information for Rails 3.2. I want to use Grunt/GulpJs and bower to handle all of my assets and I cannot seem to find something for this. Rather I find a decent amount but most of it doesn't apply to me or is broken. There is the half-pipe gem. However half-pipe relies on Rails 4.0 and I'm on Rails 4.1 and I can't find where to force a Gem to install in different version of Rails, if that's even possible.

Sprockets::CircularDependencyError in Store#index

青春壹個敷衍的年華 提交于 2019-11-27 12:21:20
问题 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

What does require_self mean?

强颜欢笑 提交于 2019-11-27 10:40:28
问题 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? 回答1: 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

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

邮差的信 提交于 2019-11-27 09:58:44
问题 After I added Sprockets, Rails is loading very slow in development mode, what should I do to speed it up? 回答1: 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

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

流过昼夜 提交于 2019-11-27 09:50:47
问题 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

Access Asset Path from Rails Controller

风格不统一 提交于 2019-11-27 06:47:19
I'm sharing a configuration yml file client side, that I need to also load on the server side, I've placed it inside app/assets/javascripts/configuration.yml I can use #{asset_path 'configuration.yml'} inside a view to get the path, but I can't inside a controller. I could access directly using "#{Rails.root}/app/assets/javascripts/configuration.yml" but when deploying the filename gets the digest string appended. How can I get the same path from a controller? ActionController::Base.helpers.asset_path("configuration.yml") Might also be good to put configuration.yml in a different folder to

PhoneGap on iOS with absolute path URLs for assets?

青春壹個敷衍的年華 提交于 2019-11-27 04:29:22
问题 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

Rails asset pipeline: Standard way for including all /vendor/assets/javascripts/?

我是研究僧i 提交于 2019-11-26 22:38:05
问题 I've been transitioning an app to Rails 3.1 (and now on to 3.2) and watched the Railscast on the asset pipeline. I moved all of my third-party jquery plugin files to the /vendor/assets/javascripts/ directory. In my /app/assets/javascripts/application.js I have the following: //= require jquery //= require jquery_ujs //= require_tree . //= require_self I realized the require_tree . call only loads the tree for the /app/assets/javascripts/ directory. (Is that correct?) What's the best way to

Rails config.assets.precompile setting to process all CSS and JS files in app/assets

元气小坏坏 提交于 2019-11-26 22:08:22
I wish to precompile all the CSS and JS files in my project's app/assets folder. I do NOT want to precompile everything in vendor/assets or lib/assets, only the dependencies of my files as needed. I tried the following wildcard setting, but it incorrectly precompiles everything. This results in lots of extra work and even causes a compilation failure when using bootstrap-sass. config.assets.precompile += ['*.js', '*.css'] What is my best bet to only process my files in app/assets ? Thanks! techpeace config.assets.precompile = ['*.js', '*.css'] That will compile any JavaScript or CSS in your