sprockets

Overriding backend assets in production environment

烈酒焚心 提交于 2019-12-23 10:50:14
问题 I am working on a project that needs to alter Refinery's WYMEditor behavior a bit. This is easily done by overriding jquery.refinery.wymeditor.js using rake refinery:override and editing it to my own needs, which works fine in development environment. However, when it comes to production, overrides are ignored. That is, the compiled asset just contains jquery.refinery.wymeditor.js from bundle, and editing that file directly there may give the desired effect, but that's just not the way it

ruby on rails: leaflet-rails not loading

拜拜、爱过 提交于 2019-12-23 03:12:31
问题 Using RoR 4.1.4 I am trying to use the leaflet-rails gem. I followed the steps outlined in the github page, but when I try to load the map, I see ReferenceError: L is not defined in the browser console. This obviously means that the helper from the gem is being loaded and executed but it can't find the leaflet.js file. However, the head section of the page shows that /assets/leaflet.js is being referenced and it actually IS there. When I look at the generated code: <div id="map"></div>

Rails asset pipeline working with fonts and yarn

徘徊边缘 提交于 2019-12-23 01:02:02
问题 I have an existing rails application where I am working on a separate branch to implement yarn for managing my vendor assets. My app stack is: ruby-2.4.0 rails 5.1.4 node 9.4.0 yarn 1.3.2 After installing yarn, I ran yarn init and it generated a package.json in the project root. After a few packages added, it looks like: # package.json { "name": "my-project-name", "version": "1.0.0", "private": true, "repository": "my-repo", "author": "me", "license": "MIT", "dependencies": { "bootstrap": "3"

sometimes javascript run perfect and sometimes not in ruby on rails 4

…衆ロ難τιáo~ 提交于 2019-12-22 08:31:02
问题 I used datepicker in calendar it shows perfect but not shows the arrow button to change month. and also give error sometimes like this: ActionController::RoutingError (No route matches [GET] "/assets/images/ui-icons_ef8c08_256x240.png") datepicker.js $(document).ready(function(){ $('[data-behaviour~=datepicker]').datepicker(); }); css link sorry for too long question and tell me if i miss something. Big thanks in advance Edit: I observed that when i delete the public/assets directory and then

Documentation for creating custom Sprockets processors?

核能气质少年 提交于 2019-12-21 03:57:19
问题 I'm trying to create a sprockets preprocessor for Rails that finds .png.rb files in the asset pipeline and uses them to generate png screenshots of various pages in my application. I've read up on this topic quite a bit but I can't seem to find any straightforward documentation on how to get this set up. Help, please? Here's what I have so far: /initializers/sprockets.rb : require 'screenshot_preprocessor' Rails.application.assets.register_mime_type('screenshot/png', '.png.rb') Rails

require_tree argument must be a directory in a Rails 5 upgraded app

心已入冬 提交于 2019-12-20 16:47:29
问题 I just upgraded my app from Rails 4.2.7 to Rails 5.0.0.1 . I used RailsDiff to make sure I had everything covered and I believe I did. So far everything has worked well up until the loading of my app. Now I am seeing this error: Sprockets::ArgumentError at / require_tree argument must be a directory This is my application.css : /* * 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

Using Sprockets as a standalone service for a PHP application

假装没事ソ 提交于 2019-12-20 14:14:15
问题 I would like to duplicate the Rails asset pipeline feature in my Zend Framework PHP project. I think that it's possible to use the Sprockets gem as a standalone service but I am not sure how to configure it properly. I'm not interested in porting Sprockets to PHP, nor using a PHP port of Sprockets. The Sprockets rubygem already has everything I need. I just need to figure out how to set it up in a non-ruby environment. Update: I have figured out how to run Sprockets as a Rack application. Now

Source maps in Ruby on Rails through sprockets

别来无恙 提交于 2019-12-20 08:57:18
问题 I'd like to add source map support on a rails 3.2 application I am working on. As far as I know, generating source maps is not supported by Sprockets and from its github page it looks like the feature is planned for 4.0. I am working with Sprockets 2.2 and I think monkey patching is the only way to go. The module Processing under the main Sprockets module gives access to the js_compressor function which can be patched to generate source map for a single file. But, I don't know how to add this

Rails 3.1 Possible Bug in Asset Pipeline and Uglifier

谁说我不能喝 提交于 2019-12-19 22:16:23
问题 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

How to load external template synchronously with backbone

不羁岁月 提交于 2019-12-19 11:56:35
问题 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