Skip to content
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

Sprites cache store #98

Closed
zemd opened this issue Sep 9, 2013 · 18 comments
Closed

Sprites cache store #98

zemd opened this issue Sep 9, 2013 · 18 comments

Comments

@zemd
Copy link

zemd commented Sep 9, 2013

Firstly got Protocol error here http://stackoverflow.com/questions/18688887/compass-protocol-error-with-import
and founded that there were some errors on windows machines with sass, so sass filesystem cache store has function [1] that fixes cache names that contain "*"

[1] ->

def path_to(key)
        key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" % Sass::Util.ord(c)}
        File.join(cache_location, key)
end

but in compass-rails sass_importer you pass sprockets cache store [2], that do not know about this problem :)
[2] ->

     # Use custom importer that knows about Sprockets Caching
      cache_store = SassCacheStore.new(context.environment)

After commenting this code, compass made sprite normally. So what is this cache for? and is there should be issue for sprockets too?

Temporary solution is to change cache dir for compass, sass and assets.
But at the moment I have not succeeded to set config.cache_store and config.assets.cache_store to any value :( rails don't want to change them.

@zemd
Copy link
Author

zemd commented Sep 9, 2013

Found how to set assets.cache-store with Sprockets::Cache::FileStore from here rails/sprockets-rails#78 but this is not best solution

@scottdavis
Copy link
Member

the entirety of compass-rails is based on "not the best solution" sprockets doesn't account for plugin libraries that need to be able to attach and create assets so we have to hack in with a good ole duck punch and make it work with a large hammer. If this will work by over riding that method i say we go with it.

@scottdavis
Copy link
Member

Do you have the code you modified someplace so i can look at it?

@zemd
Copy link
Author

zemd commented Sep 19, 2013

Hmm.. while playing with code made changes in my local gems, and now for some reasons reinstalled all ruby and gems pack.
So before reinstalling I commented 1 line in file https://github.com/Compass/compass-rails/blob/master/lib/compass-rails/patches/sass_importer.rb#L20 and that change made it possible sass to choose cache_store automatically(it uses it's own in that case https://github.com/nex3/sass/blob/stable/lib/sass/cache_stores/filesystem.rb).

@craigmcnamara
Copy link
Member

Closing this issue for inactivity. Please reopen if there is action to be taken.

@umate
Copy link

umate commented Dec 9, 2013

Got the same issue on Rails 4, Sass-rails 1.1.2 on Ubuntu 12.04 LTS
Getting the next error message:

Protocol error - {{APP_ROOT}}/tmp/cache/assets/development/sass/3cb696c0228c40a5098ddb09f5d9b49de38ba617/*.pngc

{{APP_ROOT}} here is the application root path.
Does anyone know smth about it?

@craigmcnamara plz reopen the issue.

@wldcordeiro
Copy link

@umate I've got this same issue now using Rails 4.1 on a Ubuntu 12.04 Vagrant setup, very annoying to see it's still around. :(

@scottdavis scottdavis reopened this May 23, 2014
@wldcordeiro
Copy link

I've tried adding the following to my application.rb file in my rails app but the error is still being produced.

  config.assets.paths << Rails.root.join("app", "assets", "images", "sprites")
  config.compass.generated_images_dir = 'app/assets/images/sprites'

The error I'm getting is
Protocol error @ rb_sysopen - /vagrant/projects/ReferralProgram/tmp/cache/assets/development/sass/08fbb2f6b39dc8a29f5535e59f5756becf5d423c/*.pngc (in /vagrant/projects/ReferralProgram/app/assets/stylesheets/main.scss)

@wldcordeiro
Copy link

Anyone have any ideas how to fix this issue? The error is rather cryptic.

@alexandru-calinoiu
Copy link

same error here on vagrant machine, seems to only happen on windows

@wldcordeiro
Copy link

This makes me think it's an issue regarding virtualbox, I'm going to try my
code on Linux and see.
On May 28, 2014 2:25 AM, "Calinoiu Alexandru Nicolae" <
notifications@github.com> wrote:

same error here on vagrant machine, seems to only happen on windows


Reply to this email directly or view it on GitHubhttps://github.com//issues/98#issuecomment-44378080
.

@alexandru-calinoiu
Copy link

Looking into it some more, looks like is related to the share folder sync
that vagrant does, will continue and try to find a solution.
On May 28, 2014 11:59 AM, "Wellington Cordeiro" notifications@github.com
wrote:

This makes me think it's an issue regarding virtualbox, I'm going to try
my
code on Linux and see.
On May 28, 2014 2:25 AM, "Calinoiu Alexandru Nicolae" <
notifications@github.com> wrote:

same error here on vagrant machine, seems to only happen on windows


Reply to this email directly or view it on GitHub<
https://github.com/Compass/compass-rails/issues/98#issuecomment-44378080>
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/98#issuecomment-44380882
.

@wldcordeiro
Copy link

@Balauru I had found a few other similar issues in other projects and there seems to be some kind of Vagrant config setting you can change that works for some people. I couldn't get it work for my setup though.

@alexandru-calinoiu
Copy link

Hi, I've managed to get it work by stopping the virtualbox sync and using
rsync.
On May 28, 2014 8:20 PM, "Wellington Cordeiro" notifications@github.com
wrote:

@Balauru https://github.com/balauru I had found a few other similar
issues in other projects and there seems to be some kind of Vagrant config
setting you can change that works for some people. I couldn't get it work
for my setup though.


Reply to this email directly or view it on GitHubhttps://github.com//issues/98#issuecomment-44437891
.

@wldcordeiro
Copy link

@Balauru I just did the same thing and now my errors changed to "couldn't find file '../images/affiliates-s8f538ad80b.png'" So I'm close. I'm just not sure how to reference the image files in my Rails projects.

I have

@import 'affiliates/*.png';

In my main.scss file which is in the app/assets/stylesheets folder.

@wldcordeiro
Copy link

Well now I got the files loading, sort of. They're getting generated. My sass files are finding them and my vm is as well but none of the generated images appear in my host folders.

@alexandru-calinoiu
Copy link

From what I understand from the vagrant documentation rsync will sync from
host to VM.
On May 29, 2014 12:17 AM, "Wellington Cordeiro" notifications@github.com
wrote:

Well now I got the files loading, sort of. They're getting generated. My
sass files are finding them and my vm is as well but the host doesn't seem
to have them.


Reply to this email directly or view it on GitHubhttps://github.com//issues/98#issuecomment-44465752
.

@viniciusnz
Copy link

Thanks a lot for the help guys! @wldcordeiro and @Balauru, what I did was setup the assets on an external tmp dir.

   mkdir /mnt/tmp
   chown railsuser:railsuser /mnt/tmp 

and then on application.rb

    # tmp dir for cache must be setup outside virtualbox shared folder for sass cached sprites to work
    config.assets.configure do |env|
      env.cache = ActiveSupport::Cache::FileStore.new('/mnt/tmp')
    end

This was quite a cryptic issue to deal with, since it seems like a VirtualBox issue, not rails related. I hope this helps people with the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants