envygeeks / jekyll-assets

:art: Asset pipelines for Jekyll.
ISC License
1.12k stars 170 forks source link

Using sass > 3.2.9 with jekyll-assets #53

Closed fcalderan closed 9 years ago

fcalderan commented 10 years ago

I tried to upgrade sass 3.2.9 to 3.3.0-alpha (to have sourcemap functionality enabled on Chrome) but when I compile I get this output

> jekyll build --config _config.yml,_config_dev.yml --trace                                    Configuration file: _config.yml
Configuration file: _config_dev.yml
            Source: ./src
       Destination: ./dev
      Generating... Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/common-ie8.css.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/common.css.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_variables.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_layout.css.scss.erbc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_mixins.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_normalize.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_print.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/common.css.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_variables.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_layout.css.scss.erbc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_mixins.scssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_normalize.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
Warning. Error encountered while saving cache ./.sass-cache/fd289667dafa89ff81e88d2d405f984e3d190263/_print.cssc: can't dump anonymous class #<Class:0x0000010117ebf0>
done.

I've already tried to delete and recreate .sass-cache folder with full permissions but no luck.

I've also a plugin jekyll-asset.rb in which I've disabled the cache

require "jekyll-assets"
require "yui/compressor"
require "sprockets/sass"
require "sprockets/sass/functions"

module Sprockets
  class SassCompressor
    def evaluate(context, locals, &block)

      ::Sass::Engine.new(data, {
        :syntax => :scss,
        :cache => true,  
        :line_numbers => true,
        :style => :expanded
      }).render

    end

  end
end

class Jekyll::AssetsPlugin::Renderer
  remove_const :STYLESHEET
  remove_const :JAVASCRIPT
  STYLESHEET = '<link rel="stylesheet" href="%s" />'
  JAVASCRIPT = '<script src="%s"></script>'
end

but still it doesn't work. The same problem If I use sass 3.2.11 What could it be the problem?

Thank you

fcalderan commented 10 years ago

I've found a workaround: I had to manually change the file .rvm/gems/ruby-1.9.3-p385/gems/sass-3.3.0.alpha.256/lib/sass/engine.rb and change

:cache => true

into

:cache => false

for reason the goes beyond my understanding, the same option placed in the plugin doesn't work.

Fire-Dragon-DoL commented 10 years ago

I'm facing the same issue, thanks for suggestion anyway.

Fire-Dragon-DoL commented 10 years ago

In case you need it, I have done a temporary port of this 'till is fixed: https://github.com/Fire-Dragon-DoL/sass

spajus commented 10 years ago

Why monkey-patch when you can simply add some configuration to disable caching: https://github.com/nex3/sass/blob/master/doc-src/SASS_REFERENCE.md#caching

Fire-Dragon-DoL commented 10 years ago

Because as stated, it's not working even with cache: false

metaskills commented 10 years ago

I found out that the problem was this in my env file.

config.cache_store = :dalli_store

I know this is needed to help speed up compilation, but I can do without it for now till I found back and found out how to fix it proper.

fcalderan commented 10 years ago

No, I was wrong. The issue is still there :(