Skip to content

Loading…

Inject the autoprefixer-rails CSS post-processor if present in the load path #68

Closed
wants to merge 1 commit into from

7 participants

@nz
nz commented

Per my recent issue, #67, this is the patch I'm using to add support for the autoprefixer-rails gem in my local fork. It's a really handy gem which handles CSS vendor prefixes automatically, basically replacing most of my use cases for Compass and Bourbon and the like.

My first stab here loads the gem in Environment#initialize if present in the load path. I'm not sure this is the best approach for everyone. Personally, in the day and age of Bundler, the presence of the gem in the load path is enough of an opt-in for me. But that may be too liberal for others.

So I'm open to suggestions on better modularity here. The trick is having access to the right scope for the Sprockets environment object, balanced with some better opt-in from the user to include the autoprefixer.

@coveralls

Coverage Status

Coverage remained the same when pulling ef143b1 on nz:autoprefixer-rails into 9ac861a on ixti:master.

@ixti
Jekyll member

I will add this support but in a bit different way. Hope to get to this question later this week.

@farneman

Any update on when this might get included?

@mbavio

@ixti Are you still planning to add support in your own way for this?

@ixti
Jekyll member

I plan, but my schedule is always interrupted. Pretty busy these days, but hope will have some time to close outstanding bits and release shiny new version with lots of improvements and features ;))

@ixti
Jekyll member

Merged in as bd898d4

@ixti ixti closed this
@ixti
Jekyll member

Thanks!

@silvenon

So all I need to do is add autoprefixer-rails to my Gemfile? How do I configure Autoprefixer?

@lifeiscontent

@silvenon did you figure this out? I am wondering the same thing.

@ixti
Jekyll member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 23, 2013
  1. @nz
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/jekyll/assets_plugin/environment.rb
View
7 lib/jekyll/assets_plugin/environment.rb
@@ -35,6 +35,13 @@ def initialize site
self.cache = Sprockets::Cache::FileStore.new cache_path
end
+ # load css autoprefix post-processor
+ begin
+ require 'autoprefixer-rails'
+ AutoprefixerRails.install(self)
+ rescue LoadError
+ end
+
# reset cache if config changed
self.version = site.assets_config.marshal_dump
Something went wrong with that request. Please try again.