sprockets

Using RequireJS with a Rails 3.1 app

99封情书 提交于 2019-12-02 16:40:37
Question If you've used RequireJS with a Rails 3 (esp 3.1) app, how is that working for you? Any configuration tricks or other gotchas that I need to watch out for? Background I'm contemplating using RequireJS over the Sprockets-based Asset Pipeline in Rails 3.1, specifically for JavaScript code. I have two motivators for this choice: I want to leverage RequireJS' module management for my JS client-side code. I'd like a precompilation system that can follow my JS library code into other contexts. To my surprise, the Asset Pipeline precompiler is a baked-in part of Rails, not a part of

“require_tree argument must be a directory” rails 3.1.1 precompile assets

﹥>﹥吖頭↗ 提交于 2019-12-02 15:51:08
I've been round and round here with trying to get the assets to pre-compile on my production server (straightforward ubuntu install with ruby 1.9.2 and Rails 3.1.1, and tried 3.1.2RC with the new sprockets 2.10 as well). "require_tree argument must be a directory". I've seen other issues related to this on stack but the situation isn't exactly the same and none of the proposed solutions have helped – like create a stub file in the sub folder, then reference only relatively at that point. No luck. And to top it off, of course this works perfectly on all development machines (mac's but with

Rails 3.1 Possible Bug in Asset Pipeline and Uglifier

跟風遠走 提交于 2019-12-01 19:48:59
I ran into a problem deploying on Heroku do to a failure in the rake task rake assets:precompile At the bottom is the error I get if I integrate Rails 3.1 Jquery calendar: https://github.com/themouette/jquery-week-calendar Twitter bootstrap The error happens from uglifier. I suspect that problem could be related to the inclusion of many localizations for the calendar. I worked around the error by setting: # Compress JavaScripts and CSS config.assets.compress = false I was not able to examine the files as the temporary files are cleaned up. I also could not get the debugger in RubyMine to stop

How to load external template synchronously with backbone

我的未来我决定 提交于 2019-12-01 14:15:13
I'm trying to build a mobile application with phonegap, backbone.js and coffeescript. I want to do something like this : class MyApplication.Views.EntriesIndex extends Backbone.View template: load('my/template') //It will load the external file my/template.tpl render: -> $(@el).html(@template()) this I want to load it synchronously. I already seen require.js but I find it's too complicated for this simple think. I seen than I can use JST for a rails application but I don't find how to use it without sprocket and my application must to work on the client side only. What is the better way to

Sass @import directive when used in Rails engine can't find assets in plugins

孤人 提交于 2019-12-01 10:38:38
I was building a Rails engine that uses zurb-foundation's stylesheets, and kep hitting the same Sass::Syntax error. This seemed strange because I had followed the same procedure in a Rails application and it was worked on the first try. So I decided to zero in on the isse by starting two new rails projects--one application and one engine--and configure them to use foundation with a minimal amount of setup. I started with 2 clean Rails 3.2.9 projects--one application and one engine --full and configured them both manually for foundations by adding foundation_and_overrides.scss and require -ing

Sprockets/Asset Pipeline in Rails 2.3

一曲冷凌霜 提交于 2019-12-01 09:21:13
问题 I've followed the very thorough instructions below to add sprockets/asset pipeline to a legacy Rails 2.3.18 application I'm working on: http://jaredonline.github.io/blog/2012/05/16/sprockets-2-with-rails-2-dot-3/ I have one outstanding issue -- in my vendor/assets/stylesheets/bootstrap dir, I have copied all of the .scss files from the sass-bootstrap gem. When I run the rake task provided in the above URL, rake assets:precompile , it errors out with this error: https://github.com/thomas

Sass @import directive when used in Rails engine can't find assets in plugins

独自空忆成欢 提交于 2019-12-01 07:40:43
问题 I was building a Rails engine that uses zurb-foundation's stylesheets, and kep hitting the same Sass::Syntax error. This seemed strange because I had followed the same procedure in a Rails application and it was worked on the first try. So I decided to zero in on the isse by starting two new rails projects--one application and one engine--and configure them to use foundation with a minimal amount of setup. I started with 2 clean Rails 3.2.9 projects--one application and one engine --full and

rake assets:precompile:nodigest in Rails 4

耗尽温柔 提交于 2019-12-01 03:06:43
In Rails 3 there was a rake assets:precompile:nodigest task which was compiling assets and writing them without the digest part in /public/assets directory. In Rails 4 this has been removed, and by default all assets are precompiled with digest only. For various reasons I need also non-digested version of some of the assets. Is there any easy way to enable back the old behavior? The version of sprockets-rails used in Rails 4.0.0 no longer supports non-digest assets. Per sprocket-rails's Readme : Only compiles digest filenames. Static non-digest assets should simply live in public So any assets

How to clear Sprockets cache?

耗尽温柔 提交于 2019-11-30 14:31:04
问题 When a Sprockets object compilation fails (due to a syntax error in CoffeeScript or SASS), it cannot recompile after the error is fixed because it says "file is already required." In order to get the Sprockets object to work, I have to destroy and re-create it. I was wondering if anyone knew if there was a way to tell the Sprocket object to internally reset itself as to not run into this issue. 回答1: rake tmp:cache:clear deletes the temporary cache directory. 回答2: In my case, the following

Assets say “not precompiled” when they are precompiled

久未见 提交于 2019-11-30 13:45:59
问题 Ok so, I'm getting this error when I try to use the asset pipeline. I don't understand what's causing it. Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Photos#show Showing .../app/views/photos/_photo_view.html.haml where line #2 raised: jquery.autocomplete isn't precompiled Extracted source (around line #2): 1: - content_for :scripts do 2: = javascript_include_tag 'jquery.autocomplete' However, this IS precompiled. I ran rake assets:precompile RAILS_ENV=production