-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Precompile icons in production mode #128
Comments
Hi jpmermoz, I have a similar problem. The icons from wice_grid are not showing up for me on production. What did you do to reslolve this? Thanks, |
Hi Ameya, I've downloaded all the icons and put them into the assets folder (app / assets / images / icons / grid / ) Then I rewrited my wice_grid.css.scss file to change the icon routes, here it is:
However, I just couldn't display correctly this icon: calendar_view_month.png |
Thanks, I will try that. But is this suppose to happen? I am sure there is a better and consistent way than downloading all assets. @leikind - Any recommendations? |
jpmermoz - Where did you get the icons from? Are they in this repository? |
this is definitely a TO DO for me |
Hello, I fixed this problem by renaming wice_grid.css.scss to wice_grid.css.scss.erb and replacing icon urls with asset_path helper (e.g. <%= asset_path 'icons/grid/collapse.gif' %>). Since path to calendar icon is described in wice_grid_config.rb, I found no other solution but place this icon to public/assets/icons/grid folder in my app. Hope this will be helpful. Regards, |
thanks, I will take a look |
Hi @badmanski @jpmermoz @amey1908 – I'm still having this issue too in Rails 4.0.4. Thank you @leikind for this great plugin, but unfortunately this plugin can't claim to be compatible with the asset pipeline while these issues persist! 😉 I've managed to get the images displaying correctly by following @jpmermoz's advice and converting the CSS to use image-url() instead of hard-coded url(). I also had to copy all the grid images into my local app under APP_ROOT/app/assets/images/icons/grid. Following @badmanski's advice, I also solved the hard-coded calendar icon problem by copying the calendar_view_month.png into APP_ROOT/public/assets/icons (leaving the default wice_grid_config.rb settings in place). However, this is only a work-around and is not a clean solution. I'd really like a separation between my app assets and 3rd party gem assets. I'm happy to fix the bug and submit a pull request, but @leikind – I suspect it's going to require a re-engineering of the way you handle the calendar image. There are a few things that need fixing:
I don't know the right answer yet, but perhaps wice config should just take an image path & name, and use standard Rails image_path() to convert it into an asset-pipeline compatible path? As I said, I'm happy to tackle this and submit a pull request, but I'd like @leikind's input first to make sure we're heading in the right directly. Also, @jalada, have I got all this correct? Finally, it looks like #72 is a dupe of this bug. I don't know why issue #72 is closed when it's technically still valid. Cheers, Pete Pixie Labs |
I agree with your points. This plugin started long long time before the asset pipeline. In fact, even before Rails 2, and not everything has been made up-to-date, for instance, this ugly |
Got this issue under Rails 4.1 in production env, too. |
If anyone here is still working with WiceGrid, could you see if version 3.4.9 fixes your issues? Everything should be fine except for |
@swathik @guyboertje looks like there's a new version to try at HSA – might fix a couple of the issues that @jalada and I flagged? |
@leikind I met the same problem after update the wice_grid to 3.4.9. Is that possible to call a assets helper function to generate the actual image url, like image-path( "calendar_view_month.png") . |
Here is an attempt to use the Images declared in css/sass are found, like before (in 3.4.9 I mean). If you have an idea, I'd be glad to try it. |
@leikind I try to fix it by using the helper function "asset_path" to generate the actual image path. But it failed to generate the path with a digest in production environment. |
You can notice that I tried |
Is the issue resolved in the newest version 3.4.10 ? |
The issue is not closed. All the questions I posed here are unanswered. So no, not closed. And I have no idea how.. Here are my attempts: https://github.com/leikind/wice_grid/commits/rails-asset-pipeline-kills-me |
here is a thought - can the calendar image be part of scss and styled into the grid instead of a constant in .rb. Having it in scss would allow it to be precompiled. |
Here is jquery datepicker API: http://api.jqueryui.com/datepicker/#option-buttonImage Not possible |
The gon gem could help – it adds another dependency to the project, which is unfortunate, but it fixes the problem: |
Probably not the best solution, but you can change this line in your wice grid initializer to look like this: Wice::Defaults::CALENDAR_ICON = "https://raw.github.com/leikind/wice_grid/rails3/vendor/assets/images/icons/grid/calendar_view_month.png" This will work on both development and production modes. Of course your app needs to be connected to the internet |
mmm :-/ |
I did another way. I moved file calendar_view_month.png to /public and set Wice::Defaults::CALENDAR_ICON = '/calendar_view_month.png' |
There no more png/jpg icons in the development branch 926b5be |
FWIW: Sent the CALENDAR_ICON setup to an :after_initialize block in the initializer: ActiveSupport.on_load(:after_initialize) do
# Icon to popup the calendar.
Wice::Defaults::CALENDAR_ICON = ActionController::Base.helpers.asset_path("icons/grid/calendar_view_month.png")
end |
@vovimayhem 's solution worked for me. |
Hi,
I'm having problems while precompiling wice_grid's assets in production mode.
By now, I've rewrited wice_grid css file to reference images using image-url tag, and that works for almost all images, except with 'calendar_view_month.png'.
This one is being used by wice_grid dinamically, and its path is being declared in wice_grid_config.rb initializer.
Is there a way to make rails recognize its precompiled url?
Thanks
The text was updated successfully, but these errors were encountered: