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.
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
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.
Cool. Don’t forget add Jekyll How To to Autoprefixer’s README, when you will release it :).
@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
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?
@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.
@nz Thanks, so the output CSS should already have prefixes (where applicable) without any other steps? This isn't happening on my end.
Are you sure I don't need to create a converter plugin as well? http://jekyllrb.com/docs/plugins/
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.
@ajkochanowicz did you have any luck with this? I'm having the same issue.
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"
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.
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:
If you need to tune-up autoprefixer config, create autoprefixer.yml config file in the root of your site directory.
@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.