Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support for CSS autoprefixer gem #67

Closed
nz opened this Issue · 11 comments

5 participants

@nz
nz commented

The CSS autoprefixer gem looks great, and it can be used by Sprockets as a CSS post-processor. Seems like a nice addition for jekyll-assets to lazily include if the gem is present in the load path.

https://github.com/ai/autoprefixer-rails

I have a local fork that's just dynamically injecting in the Jekyll::AssetsPlugin::Environment#initialize method if it can require the gem:

# load css autoprefix post-processor
begin
  require 'autoprefixer-rails'
  AutoprefixerRails.install(self)
rescue LoadError
end

That gets the job done without much fuss, though there may be a better way. Happy to whip this up into a proper pull request if I can get some guidance on a more modular place to hook in to the Sprockets environment object.

@ai
ai commented

Cool. Don’t forget add Jekyll How To to Autoprefixer’s README, when you will release it :).

@ixti ixti self-assigned this
@ixti
Owner

@ai @nz I have merged PR of @nz, but have some thoughts on refactoring it later (gonna rework how extras are enabled / installed in general -- want to support options / configs etc). Will try to provide PR for autoprefixer README afterwards

@ixti ixti closed this
@adamjgrant

Autoprefixer's docs instruct simply to install jekyll-assets and autoprefixer-rails but I assume there's more to it than that. Is this documented somewhere?

@nz
nz commented

@ajkochanowicz simple as that.

Jekyll Assets tries to require the autoprefixer-rails gem. If successful, then it sets up Autoprefixer, otherwise it quietly rescues the LoadError moves on.

@adamjgrant

@nz Thanks, so the output CSS should already have prefixes (where applicable) without any other steps? This isn't happening on my end.

@adamjgrant

Are you sure I don't need to create a converter plugin as well? http://jekyllrb.com/docs/plugins/

@adamjgrant

It seems like you would also need to add the two gems to _config.yml per the jekyll docs. I did that, but still no success.

@adamjgrant adamjgrant referenced this issue in postcss/autoprefixer
Closed

Jekyll Installation Instructions #388

@danschultz

@ajkochanowicz did you have any luck with this? I'm having the same issue.

@ixti
Owner

As part of my roadmap for 1.0 release all 3rd-party integrations are moved out of the core (by different reasons). So, if you are using master branch and not latest stable release, you won't have any integrations like bourbon or compass out of the box. You will need to either setup integrations yourself with configure api:

::Jekyll::Assets.configure do |assets|
  assets.append_path "some path to compass assets"
end

Or, in case of Autoprefixer, you can use jekyll-assets-autoprefixer gem to do all the magic for you.

NB This instructions are valid for master branch only. If you are using stable release (0.14.x) you should follow instructions given on Jekyll::Assets README or Autoprefixer's README.

@ixti
Owner

If you are experiencing troubles with 0.14 version of jekyll-assets, please, provide some more details (a test repo will be huge help). Basically, installation should be pretty simple:

  • add gem "autoprefxer-rails" into your Gemfile with gem "jekyll-assets" and you're done.

If you need to tune-up autoprefixer config, create autoprefixer.yml config file in the root of your site directory.

@danschultz

@ixti, I'm using jekyll-assets version 0.14, with autoprefixer version 5.1.0. You should be able to reproduce the problem on my branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.