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

Make config variables accessible from JekyllAssetPipeline::Converter #37

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

Make config variables accessible from JekyllAssetPipeline::Converter #37

NV opened this issue Aug 16, 2013 · 0 comments

Comments

@NV
Copy link

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?

janosrusiczki added a commit that referenced this issue Dec 14, 2017
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

1 participant