Autoprefixer integration for Jekyll
This plugin provides simple autoprefixer support for Jekyll.
This plugin is available as a RubyGem.
Add this line to your application's Gemfile
:
gem 'jekyll-autoprefixer'
And then execute the bundle
command to install the gem.
Alternatively, you can also manually install the gem using the following command:
$ gem install jekyll-autoprefixer
After the plugin has been installed successfully, add the following lines to your _config.yml
in order to tell Jekyll to use the plugin:
plugins:
- jekyll-autoprefixer
No additional steps are required. All written CSS files inside the destination directory are overwritten with the output of autoprefixer.
You can optionally configure the behavior of autoprefixer using the following options in your _config.yml
:
You can specify the browsers for which autoprefixer is supposed to generate prefixes for:
autoprefixer:
browsers:
- last 2 versions
You can specify that autoprefixer should only work in production mode (i.e. when JEKYLL_ENV
is production
).
autoprefixer:
only_production: true # defaults to false
You can tell autoprefixer to not process static files (i.e. files without a YAML frontmatter) by setting process_static_files:
to false
,
to mirror the default behavior of Jekyll and most plugins to only transform files that have front matter.
autoprefixer:
process_static_files: false # defaults to true (for legacy reasons)
If you want to exclude one or more individual files from processing, you can set process_with_autoprefixer: false
in the files frontmatter or the sites frontmatter defaults in _config.yml
.
In
yourfile.css
,yourfile.scss
or similar (Note: Only files that are converted into or already are a.css
file will be processed by autoprefixer):--- process_with_autoprefixer: false --- .css { ... }
You can also set process_static_files:
to false
, and use individual YAML frontmatter defaults to enable it for certain files:
autoprefixer:
process_static_files: false
defaults:
- scope:
path: "assets/css/yourfile.css"
values:
process_with_autoprefixer: true
You can influence whether sourcemaps are generated by autoprefixer. If a previous step (e.g. SASS) has already produced a sourcemap, the latter will be used as the base for the new sourcemap:
autoprefixer:
# Possible values:
# never - no source maps to be generated or transformed
# always - source maps will always be generated resp. transformed
# existing - only update source maps generated by other tools; do not generate new source maps from scratch
# development - source maps will only be generated resp. transformed if JEKYLL_ENV == development
# production - source maps will only be generated resp. transformed if JEKYLL_ENV == production
#
# Defaults to 'existing'.
sourcemaps: always
Fork this repository, make your changes and then issue a pull request. If you find bugs or have new ideas that you do not want to implement yourself, file a bug report.
Copyright (c) 2015 Vincent Wochnik.
License: MIT