sprockets

How to get asset version string from the asset pipeline

♀尐吖头ヾ 提交于 2019-12-13 08:27:17
问题 I'm adding a really simple caching script (JavaScript) to a rails project, and need to get the rails asset version number in order to make the two work together nicely. I can't however find out how to get the versioning string for use. I need to update the two strings below (in a JS file) with the relevant version string from rails. How can I get this information. var urlsToCache = [ '/css/main.css', '/javascript/application.js' ]; I'm aware that I may need to export the version string as

Trouble loading Rails Server (3.0.11, ruby 1.9.2), no such file to load — sprockets/railtie (LoadError)

狂风中的少年 提交于 2019-12-13 06:27:57
问题 Using the Hartl tutorial. Command: rails s Response: /Users/davidpardy/rails_projects/sample_app/config/application.rb:8:in `require': no such file to load -- sprockets/railtie (LoadError) from /Users/davidpardy/rails_projects/sample_app/config/application.rb:8:in `<top (required)>' from /Users/davidpardy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.11/lib/rails /commands.rb:28:in `require' from /Users/davidpardy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.11/lib/rails /commands.rb:28:in

Sprockets and rails 3 - adding a new precompiled js file

半城伤御伤魂 提交于 2019-12-12 18:28:27
问题 I currently have a file app/assets/javascripts/application.js which has a list of requires in it, and which, when i run rake assets:precompile cleans, minifies and concatenates all of the listed files into public/assets/application.js . That's all working fine. However, i want to add another precompiled js file called 'show_tale.js', with a different list of js files to pull in. I've added a show_tale.js file into app/assets/javascripts which has the list of requires in it. But, when i do

“stack level too deep” while compiling assets

北慕城南 提交于 2019-12-12 11:24:21
问题 After running brew upgrade , or something else which updated my gems/ruby version, my rake assets:precompile task no longer works. I get this error: rake aborted! stack level too deep (in /Users/Jordan/Development/reejay/rails/reejay/app/assets/stylesheets/blog_player.css.scss) /Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:162 Tasks: TOP => assets:precompile:primary rake aborted! Command failed with status (1): [/usr/local/Cellar/ruby/1.9.3-p0/bin/ruby /...] /usr

Rails4 Sprockets; Asset logical path has no extension

两盒软妹~` 提交于 2019-12-12 08:19:02
问题 I recently upgraded to Rails 4, and whilst running my request specs I started getting the following error: Failure/Error: Unable to find matching line from backtrace Sprockets::ArgumentError: Asset logical path has no extension: europe Blockquote# /usr/local/rvm/gems/ruby-1.9.3-p448/gems/sprockets-2.10.1/lib/sprockets/asset.rb:36:in initialize' # /usr/local/rvm/gems/ruby-1.9.3-p448/gems/sprockets-2.10.1/lib/sprockets/base.rb:380:in new' # /usr/local/rvm/gems/ruby-1.9.3-p448/gems/sprockets-2

Cannot configure assets via pipeline on local production rails 3.1.3 server

谁说我不能喝 提交于 2019-12-12 03:06:14
问题 This month, I upgraded from Rails 3.0 to Rails 3.1 - this week I tried to launch the server in production mode - today I have hit a wall ! I am unable to get my production environment server to serve up my public assets (JavaScript and CSS) via the asset pipeline, unless I set config.assets.compile = true in my environment.rb file, which for speed reasons I obviously don't want to do. I have a large number of JS and CSS files, each of which tends to get used on one or two different pages.

rails web pack react - sprocket couldn't find file react-server

老子叫甜甜 提交于 2019-12-11 15:57:03
问题 I am trying to install react through webpack using rails 4.2.7 I followed this one https://github.com/rails/webpacker and stuck with the error Sprockets::FileNotFound at / couldn't find file 'react-server' with type 'application/javascript' Checked in these paths: /Users/dev/Documents/ff/app/assets/images /Users/dev/Documents/ff/app/assets/javascripts /Users/dev/Documents/ff/app/assets/stylesheets /Users/dev/Documents/ff/vendor/assets/javascripts /Users/dev/Documents/ff/vendor/assets

how to use sprockets imports with sass

蓝咒 提交于 2019-12-11 13:00:23
问题 I have a application.css.scss with the following content - @import bootstrap Now I would like to use the chosen-rails gem, and add the following sprokets directive to my application.css.scss file - *= require chosen I installed the sprockets-sass gem, and changed my application.css.scss file to - @import bootstrap //*= require chosen However I dont see the chosen css appear, what am I doing wrong? 回答1: Try using only the @import syntax: @import 'bootstrap' @import 'chosen' The 'sass-rails'

Heroku serves assets very slowly

霸气de小男生 提交于 2019-12-11 09:59:30
问题 I'm having huge trouble serving assets in my Rails application .Loading a 2KB image on my VPS (served directly by nginx, not Rails) takes me 42ms. Loading it on Heroku might take more than 1 minute sometimes. The strange fact is that at this point the application is just a bunch of static pages served through High Voltage. All my assets are precompiled locally. I have the rails_12factor and heroku_rails_deflate gems installed. Here's my Sprockets configuration: config/initializers/assets.rb #

How to share the same instance of jQuery across multiple Webpack packs?

那年仲夏 提交于 2019-12-11 07:39:10
问题 I'm working in a Rails app, migrating from Sprockets to Webpack. Our current JavaScript relies on libraries globally assigned to window . In order to migrate over, I'd like to maintain global assignment until we address it at a later date. I'd like to swap from Sprockets to Webpack without any JavaScript changes. We have several JavaScript bundles, which have been manually split up for performance: core.js , which contains jQuery and a couple other files. It's a blocking bundle. vendor.js ,