Skip to content

Conversation

@josh
Copy link
Contributor

@josh josh commented Dec 20, 2014

Needed to ensure our "virtual" glob sass file has a unique name otherwise it gets .uniq'd alway in Sass's dependency Set here https://github.com/sass/sass/blob/2bdc564dea068c4e19064daea25349d93f8d01b8/lib/sass/engine.rb#L331

It sorta makes me worry a little bit about the virtual file approach. :filename => nil would make more sense in this case, but other internal sass APIs seem to assume :filename exists for any relative import calls. So those would crash or be incorrect if we set it to nil or some random value. Another approach might be writing out a "real" file to tmp, but I don't know how that would affect sass's internal cache.

Fixes #299.

/cc
@ksylvest if you wouldn't mind testing this branch before we do a final release
@rafaelfranca we'll probably want to cut a new patch level release after this.

@josh josh self-assigned this Dec 20, 2014
@ksylvest
Copy link

@josh Tested in the sample and in the other project. Both are now updating! Thanks for the really fast fix Josh.

@agrobbin
Copy link
Contributor

Just ran into this ourselves, thanks for the fix @josh! I've tested this in our app as well and it resolves the issue entirely. Hopefully a new patch release is put out with this soon.

josh added a commit that referenced this pull request Dec 24, 2014
@josh josh merged commit d67a424 into master Dec 24, 2014
@josh josh deleted the fix-glob-virtual-file branch December 24, 2014 20:18
@josh josh mentioned this pull request Dec 24, 2014
leonelgalan added a commit to smashingboxes/cardboard-admin-archive that referenced this pull request Jan 20, 2015
sass-rails 5.0.1 includes caching bug experienced by malartu, more on
this bug: rails/sass-rails#301 and
rails/sass-rails#299

“If you want to allow use of newer backwards-compatible versions but
need a specific bug fix you can use a compound requirement:

```
# gemspec
spec.add_runtime_dependency 'library', '~> 2.2', '>= 2.2.1'

# bundler
gem 'library', '~> 2.2', '>= 2.2.1'
```
“
@coladarci
Copy link

Sorry for jumping on such an old thread, but I have these same symptoms on sass-rails-3.2.6 (we are stuck on Rails 3, unfortunately).

Looking at this method in 3.2.6:

    def glob_imports(glob, base_pathname, options)
      contents = ""
      each_globbed_file(glob, base_pathname.dirname, options) do |filename|
        if File.directory?(filename)
          context.depend_on(filename)
        elsif context.asset_requirable?(filename)
          context.depend_on(filename)
          contents << "@import #{Pathname.new(filename).relative_path_from(base_pathname.dirname).to_s.inspect};\n"
        end
      end
      return nil if contents.empty?
      Sass::Engine.new(contents, options.merge(
        :filename => base_pathname.to_s,
        :importer => self,
        :syntax => :scss
      ))
    end

What's concerning is that this just started happening recently, and I can't detect any changes in our gem versions. We did recently switch to new computers, so I'm wondering if a something on the system could have changed that created this problem. If anyone has any ideas, we are in a real bind..

Thanks!

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

Successfully merging this pull request may close these issues.

Not Detecting Changes when using the Glob Import

5 participants