sprockets

Rails 3.2.8 Application.js and Application.css are not working as expcted

喜你入骨 提交于 2019-12-18 13:08:42
问题 When i try to include <%= stylesheet_link_tag "application" %> <%= javascript_include_tag "application" %> The content of the files of the application.css is: /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to

Asset compiling crashing on server environment with: “NoMethodError: undefined method `[]' for nil:NilClass”

ⅰ亾dé卋堺 提交于 2019-12-18 12:13:08
问题 I've been pulling my hair out for this one. I've always had a bad relationship with the asset-pipeline, it is always giving me trouble.. And today again.. When I try and compile my assets locally, everything is fine: $ RAILS_ENV=production rake assets:precompile --trace But when I deploy with Capistrano which does: cd /var/www/xxx/releases/20140717164232 && ( RAILS_ENV=production bundle exec rake assets:precompile ) It crashes with the following error: rake aborted! NoMethodError: undefined

Access Asset Path from Rails Controller

亡梦爱人 提交于 2019-12-17 08:35:11
问题 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? 回答1: ActionController::Base

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

烈酒焚心 提交于 2019-12-17 05:51:53
问题 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!

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

与世无争的帅哥 提交于 2019-12-17 05:51:39
问题 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!

How to optimize the asset compilation rake task in Rails 3.1 while deploying eating up the all memory?

此生再无相见时 提交于 2019-12-14 04:11:37
问题 The production box is of 768MB node at Linode. When I am deploying a Rails 3.1 app, the asset compilation takes place which invokes other 2 rake tasks with the Rails app env loaded. So, one task is occupying 30% of the memory which makes the 3 tasks to 90% of the memory and the capistrano command dies with zlib(finalizer): the stream was freed prematurely. error. Its getting me frustrated since it has already ate my whole day!! 回答1: This is know rails issue. You can find one solution here 来源:

Sprockets require asset over HTTP

醉酒当歌 提交于 2019-12-14 02:25:35
问题 I would like to know if it's possible to require some assets over HTTP, eg: /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the top of the *

Why Rails Asset Pipeline uses require instead of @import?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 21:00:24
问题 If Rails (3, 4) uses SASS for precompile the CSS, Why uses "require" for default, instead of Sass directive "@import" (http://sass-lang.com/documentation/file.SASS_REFERENCE.html#import) The same Rails documentation suggest to use "@import" (http://edgeguides.rubyonrails.org/asset_pipeline.html) 回答1: As noted in the document you linked to, @import is preferable because Sass variables can be shared between files. But having the Sprockets-provided require directive allows you to include

How do you instruct Sprockets to include files from /vendors/assets/components on Heroku?

和自甴很熟 提交于 2019-12-13 14:45:52
问题 I want to manage clientside assets using Bower which installs resources such as angular into /vendors/assets/components/angular/angular.js I reference these assets in the application.css.scss file as follows: /* ... *= require bootstrap */ However while this works ok for development and the files are included ok, they're not getting picked up by sprockets for compilation in production on Heroku. How can I instruct Sprockets to pick up and compile files from /vendor/assets/components/ ? 回答1:

Use Rails 3.1 Asset Paths in a SCSS Partial

假如想象 提交于 2019-12-13 14:41:03
问题 I have the following setup: app/assets/stylesheets/application.css.scss /* *= require_self *= require fancybox */ /* COLORS.. */ /* MIXINS... */ /* FONT STACKS... */ /* IMPORTS */ @import "reset"; @import "supergrid"; @import "rails"; @import "app"; @import "forms"; @import "layout"; In my various partials I'm having a real problem with the asset paths. When inside application.css.scss or anything loaded by the manifest, I can use: .example { background-image: image-path("background.png"); }