Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Make config variables accessible from JekyllAssetPipeline::Converter #37

Open
NV opened this Issue Aug 16, 2013 · 0 comments

Comments

Projects
None yet
1 participant

NV commented Aug 16, 2013

I want to compile SASS with sourcemaps for dev mode, and --output-style compressed for production mode.

I introduces a switch in _config.yml

dev: true

Can I access it from Jekyll Asset Pipeline plug-in?

module JekyllAssetPipeline
  class CompassConverter < JekyllAssetPipeline::Converter
    require 'compass'
    require 'tempfile'

    def self.filetype
      '.scss'
    end

    def initialize(asset)
      @asset = asset
      super
    end

    def convert
      output = Tempfile.new('compass_output')
      Compass.add_project_configuration({:sourcemap => true})
      Compass.configure_sass_plugin!
      Compass.compiler.compile("./source/_assets/#{@asset.filename}", output.path)
      output.read
    end
  end
end

For Jekyll::Converter it’s accessible, I believe, via @config. Can JekyllAssetPipeline::Converter make @config accessible by, for example, inheriting from Jekyll::Converter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment