https://github.com/ai/autoprefixer-rails
Autoprefixer for Ruby and Ruby on Rails
https://github.com/ai/autoprefixer-rails
Keywords from Contributors
activerecord activejob mvc rubygems rack rubocop rspec sinatra ruby-gem static-code-analysis
Last synced: about 13 hours ago
JSON representation
Repository metadata
Autoprefixer for Ruby and Ruby on Rails
- Host: GitHub
- URL: https://github.com/ai/autoprefixer-rails
- Owner: ai
- License: mit
- Created: 2013-04-04T22:01:13.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2025-04-12T14:28:49.000Z (11 months ago)
- Last Synced: 2026-02-26T15:56:10.164Z (14 days ago)
- Language: Ruby
- Homepage: https://twitter.com/autoprefixer
- Size: 25.2 MB
- Stars: 1,210
- Watchers: 16
- Forks: 109
- Open Issues: 7
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
README.md
Autoprefixer Rails 
Autoprefixer is a tool to parse CSS and add vendor prefixes to CSS rules
using values from the Can I Use database. This gem provides Ruby
and Ruby on Rails integration with this JavaScript tool.
Differences
The best way to use Autoprefixer is with webpack or Gulp.
Autoprefixer Rails doesn’t support these Autoprefixer features:
- Browsers in
package.json. - Custom browsers usage statistics.
Usage
Windows users should install Node.js. Autoprefixer Rails doesn’t work with
old JScript in Windows.
Autoprefixer Rails uses ExecJS that will use the best available JavaScript
runtime. Currently this gem is tested to work with Node.js version 10 and up
and with mini_racer, but will not work with therubyracer.
Ruby on Rails
Add the autoprefixer-rails gem to your Gemfile:
gem "autoprefixer-rails"
Clear your cache:
rake tmp:clear
Write your CSS (Sass, Stylus, LESS) rules without vendor prefixes
and Autoprefixer will apply prefixes for you.
For example in app/assets/stylesheet/foobar.sass:
:fullscreen a
display: flex
Autoprefixer uses the Can I Use database with browser statistics and properties
support to add vendor prefixes automatically using the Asset Pipeline:
:-webkit-full-screen a {
display: -webkit-box;
display: -webkit-flex;
display: flex
}
:-moz-full-screen a {
display: flex
}
:-ms-fullscreen a {
display: -ms-flexbox;
display: flex
}
:fullscreen a {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex
}
If you need to specify browsers for your Rails project, you can save them
to .browserslistrc and place it under app/assets/stylesheets/
or any of its ancestor directories
> 1%
last 2 versions
IE > 8 # comment
See Browserslist docs for config format. But > 5% in US query is not
supported in Rails, because of ExecJS limitations. You should migrate to webpack
or Gulp if you want it.
Note: you have to clear cache (rake tmp:clear) for the configuration
to take effect.
You can get what properties will be changed using a Rake task:
rake autoprefixer:info
To disable Autoprefixer just remove postprocessor:
AutoprefixerRails.uninstall(Rails.application.assets)
Sprockets
If you use Sinatra or another non-Rails framework with Sprockets,
just connect your Sprockets environment with Autoprefixer and write CSS
in the usual way:
assets = Sprockets::Environment.new do |env|
# Your assets settings
end
require "autoprefixer-rails"
AutoprefixerRails.install(assets)
Ruby
If you need to call Autoprefixer from plain Ruby code, it’s very easy:
require "autoprefixer-rails"
prefixed = AutoprefixerRails.process(css, from: 'main.css').css
Compass
You should consider using Gulp instead of Compass binary,
because it has better Autoprefixer integration and many other awesome plugins.
But if you can’t move from Compass binary right now, there’s a hack
to run Autoprefixer after compass compile.
Install autoprefixer-rails gem:
gem install autoprefixer-rails
and add post-compile hook to config.rb:
require 'autoprefixer-rails'
on_stylesheet_saved do |file|
css = File.read(file)
map = file + '.map'
if File.exists? map
result = AutoprefixerRails.process(css,
from: file,
to: file,
map: { prev: File.read(map), inline: false })
File.open(file, 'w') { |io| io << result.css }
File.open(map, 'w') { |io| io << result.map }
else
File.open(file, 'w') { |io| io << AutoprefixerRails.process(css) }
end
end
Visual Cascade
By default, Autoprefixer will change CSS indentation to create nice visual
cascade of prefixes.
a {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}
You can disable this by specifying cascade: false in config/autoprefixer.yml
or in process() options.
Source Map
Autoprefixer will generate a source map if you set map option to true in
process method.
You must set input and output CSS files paths (by from and to options)
to generate a correct map.
result = AutoprefixerRails.process(css,
map: true,
from: 'main.css',
to: 'main.out.css')
Autoprefixer can also modify previous source map (for example, from Sass
compilation). Just set original source map content (as string) as prev
in the map option.
result = AutoprefixerRails.process(css, {
map: { prev: File.read('main.sass.css.map') },
from: 'main.sass.css',
to: 'main.min.css')
result.map #=> Source map from main.sass to main.min.css
See all options in PostCSS docs. AutoprefixerRails will convert Ruby style
to JS style, so you can use map: { sources_content: false }
instead of camelcase sourcesContent.
Security Contact
To report a security vulnerability, please use the Tidelift security contact.
Tidelift will coordinate the fix and disclosure.
Owner metadata
- Name: Andrey Sitnik
- Login: ai
- Email:
- Kind: user
- Description: The creator of Autoprefixer, @postcss, @browserslist, and @logux
- Website: https://sitnik.ru
- Location: Barcelona, Spain
- Twitter: sitnikcode
- Company: @evilmartians
- Icon url: https://avatars.githubusercontent.com/u/19343?u=109019153065fd4af98d015da3ee415790e2ef3e&v=4
- Repositories: 83
- Last ynced at: 2024-11-24T17:54:30.925Z
- Profile URL: https://github.com/ai
GitHub Events
Total
- Pull request event: 2
- Fork event: 2
- Issues event: 4
- Watch event: 6
- Issue comment event: 3
- Push event: 4
- Create event: 1
Last Year
- Issues event: 3
- Watch event: 3
- Push event: 3
- Create event: 1
Committers metadata
Last synced: 4 days ago
Total Commits: 1,002
Total Committers: 58
Avg Commits per committer: 17.276
Development Distribution Score (DDS): 0.139
Commits in past year: 3
Committers in past year: 1
Avg Commits per committer in past year: 3.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Andrey Sitnik | a****y@s****u | 863 |
| Albert Song | a****0@g****m | 52 |
| Olle Jonsson | o****n@a****m | 7 |
| Utkarsh Gupta | u****h@d****g | 6 |
| Sergio Tapia Gutierrez | s****a@o****m | 4 |
| Sasha Koss | k****s@n****e | 4 |
| Dominik Porada | d****k@p****o | 3 |
| Gleb Mazovetskiy | g****b@g****m | 3 |
| Joshua Peek | j****h@j****m | 3 |
| Kir Shatrov | s****v@m****m | 3 |
| Orien Madgwick | 4****n | 3 |
| schneems | r****n@g****m | 2 |
| Vladimir Dementyev | d****m@g****m | 2 |
| Thomas Walpole | t****e@g****m | 2 |
| Eloy Espinaco | e****p@g****m | 2 |
| 284km | k****0@g****m | 1 |
| Adam Becker | ad@m****c | 1 |
| Adam Bouqdib | a****m@a****k | 1 |
| Adam Bowen | a****n@g****m | 1 |
| Alex Tambellini | a****i@g****m | 1 |
| Alexey Vasiliev | l****a@g****m | 1 |
| Ayaka Hanaoka | a****7@g****m | 1 |
| Bian Jiaping | s****p@g****m | 1 |
| Chris Salzberg | c****g@s****m | 1 |
| Daisuke Taniwaki | d****i@g****m | 1 |
| Dave Ungerer | d****e@s****a | 1 |
| Dinuz | m****o@g****m | 1 |
| Eda Riedl | e****l@g****m | 1 |
| Hannes Gustafsson | h****n@g****m | 1 |
| thomas morgan | tm@i****m | 1 |
| and 28 more... | ||
Committer domains:
- me.com: 2
- debian.org: 2
- room118solutions.com: 1
- riseup.net: 1
- marc-andre.ca: 1
- graybike.co: 1
- iprog.com: 1
- simplepay.co.za: 1
- shopify.com: 1
- abemedia.co.uk: 1
- mbecker.cc: 1
- joshpeek.com: 1
- porada.co: 1
- nocorp.me: 1
- auctionet.com: 1
- sitnik.ru: 1
Issue and Pull Request metadata
Last synced: 10 days ago
Total issues: 53
Total pull requests: 54
Average time to close issues: about 2 months
Average time to close pull requests: 24 days
Total issue authors: 50
Total pull request authors: 37
Average comments per issue: 6.17
Average comments per pull request: 1.89
Merged pull request: 41
Bot issues: 0
Bot pull requests: 0
Past year issues: 2
Past year pull requests: 1
Past year average time to close issues: 13 days
Past year average time to close pull requests: 2 days
Past year issue authors: 2
Past year pull request authors: 1
Past year average comments per issue: 1.0
Past year average comments per pull request: 2.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- tokgrabber (3)
- ai (3)
- bunnymatic (2)
- bobbus (1)
- eloyesp (1)
- joker-777 (1)
- pravi (1)
- pelcasandra (1)
- toncid (1)
- jfo84 (1)
- aschrafl (1)
- zedalaye (1)
- BenAkroyd (1)
- xinlangzi (1)
- ijunaid8989 (1)
Top Pull Request Authors
- albb0920 (7)
- utkarsh2102 (4)
- olleolleolle (4)
- pravi (3)
- dtaniwaki (2)
- KSH-code (2)
- eloyesp (2)
- palkan (2)
- andrew (2)
- cr7pt0gr4ph7 (2)
- Hanachanm (1)
- m-nakamura145 (1)
- viraptor (1)
- ghost (1)
- javierjulio (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 6
-
Total downloads:
- rubygems: 308,448,286 total
- Total docker downloads: 1,123,436,568
- Total dependent packages: 138 (may contain duplicates)
- Total dependent repositories: 137,372 (may contain duplicates)
- Total versions: 589
- Total maintainers: 3
gem.coop: autoprefixer-rails
Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website.
- Homepage: https://github.com/ai/autoprefixer-rails
- Documentation: http://www.rubydoc.info/gems/autoprefixer-rails/
- Licenses: MIT
- Latest release: 10.0.0 (published over 5 years ago)
- Last Synced: 2026-03-10T05:31:43.874Z (2 days ago)
- Versions: 292
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 154,243,446 Total
- Docker Downloads: 561,718,284
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.054%
- Downloads: 0.163%
- Maintainers (3)
-
Funding:
- https://tidelift.com/subscription/pkg/rubygems-autoprefixer-rails
rubygems.org: autoprefixer-rails
Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website.
- Homepage: https://github.com/ai/autoprefixer-rails
- Documentation: http://www.rubydoc.info/gems/autoprefixer-rails/
- Licenses: MIT
- Latest release: 10.0.0 (published over 5 years ago)
- Last Synced: 2026-03-09T16:30:48.340Z (3 days ago)
- Versions: 292
- Dependent Packages: 138
- Dependent Repositories: 137,372
- Downloads: 154,204,840 Total
- Docker Downloads: 561,718,284
-
Rankings:
- Dependent repos count: 0.105%
- Downloads: 0.142%
- Docker downloads count: 0.214%
- Dependent packages count: 0.254%
- Average: 0.828%
- Stargazers count: 1.739%
- Forks count: 2.514%
- Maintainers (3)
-
Funding:
- https://tidelift.com/subscription/pkg/rubygems-autoprefixer-rails
proxy.golang.org: github.com/ai/autoprefixer-rails
- Homepage:
- Documentation: https://pkg.go.dev/github.com/ai/autoprefixer-rails#section-documentation
- Licenses: mit
- Latest release: v0.8.20131205 (published over 12 years ago)
- Last Synced: 2026-03-08T09:24:57.611Z (4 days ago)
- Versions: 2
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
debian-10: ruby-autoprefixer-rails
- Homepage: https://github.com/ai/autoprefixer-rails
- Documentation: https://packages.debian.org/buster/ruby-autoprefixer-rails
- Licenses:
- Latest release: 8.6.5+dfsg-3 (published 29 days ago)
- Last Synced: 2026-02-13T04:19:20.099Z (27 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-autoprefixer-rails
- Homepage: https://github.com/ai/autoprefixer-rails
- Licenses: mit
- Latest release: 8.6.5+dfsg-3 (published 27 days ago)
- Last Synced: 2026-02-13T07:10:03.736Z (27 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
guix: ruby-autoprefixer-rails
Parse CSS and add vendor prefixes to CSS rules
- Homepage: https://github.com/ai/autoprefixer-rails
- Documentation: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/rails.scm#n254
- Licenses: expat
- Latest release: 10.4.13.0 (published 10 days ago)
- Last Synced: 2026-03-02T19:04:01.646Z (10 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- @rollup/plugin-alias ^3.1.1 development
- @rollup/plugin-commonjs ^17.0.0 development
- @rollup/plugin-inject ^4.0.2 development
- @rollup/plugin-json ^4.1.0 development
- @rollup/plugin-node-resolve ^11.0.1 development
- @rollup/plugin-replace ^2.3.3 development
- rollup ^2.27.0 development
- rollup-plugin-node-polyfills ^0.2.1 development
- autoprefixer ^10.4.7
- nop ^1.0.0
- postcss ^8.2.4
- text-encoding ^0.7.0
- whatwg-url ^9.0.0
- @rollup/plugin-alias 3.1.1
- @rollup/plugin-commonjs 17.0.0
- @rollup/plugin-inject 4.0.2
- @rollup/plugin-json 4.1.0
- @rollup/plugin-node-resolve 11.0.1
- @rollup/plugin-replace 2.3.4
- @rollup/pluginutils 3.1.0
- @types/estree 0.0.45
- @types/estree 0.0.39
- @types/node 14.14.16
- @types/resolve 1.17.1
- autoprefixer 10.4.7
- balanced-match 1.0.0
- brace-expansion 1.1.11
- browserslist 4.20.3
- builtin-modules 3.2.0
- caniuse-lite 1.0.30001335
- colorette 1.2.2
- commondir 1.0.1
- concat-map 0.0.1
- deepmerge 4.2.2
- electron-to-chromium 1.4.131
- escalade 3.1.1
- estree-walker 0.6.1
- estree-walker 1.0.1
- estree-walker 2.0.2
- fraction.js 4.2.0
- fs.realpath 1.0.0
- fsevents 2.1.3
- function-bind 1.1.1
- glob 7.1.6
- has 1.0.3
- inflight 1.0.6
- inherits 2.0.4
- is-core-module 2.2.0
- is-module 1.0.0
- is-reference 1.2.1
- magic-string 0.25.7
- minimatch 3.0.4
- nanoid 3.1.20
- node-releases 2.0.4
- nop 1.0.0
- normalize-range 0.1.2
- once 1.4.0
- path-is-absolute 1.0.1
- path-parse 1.0.6
- picocolors 1.0.0
- picomatch 2.2.2
- postcss 8.2.4
- postcss-value-parser 4.2.0
- punycode 2.1.1
- resolve 1.19.0
- rollup 2.35.1
- rollup-plugin-inject 3.0.2
- rollup-plugin-node-polyfills 0.2.1
- rollup-pluginutils 2.8.2
- slash 3.0.0
- source-map 0.6.1
- sourcemap-codec 1.4.8
- text-encoding 0.7.0
- tr46 2.1.0
- webidl-conversions 6.1.0
- whatwg-url 9.0.0
- wrappy 1.0.2
- execjs ~> 2
- mini_racer >= 0
- rails >= 5.0.0.beta2
- sassc-rails >= 0
- sprockets >= 4.0.0.beta1
- rails >= 0 development
- rake >= 0 development
- rspec-rails >= 0 development
- rubocop ~> 0.85.1 development
- rubocop-packaging ~> 0.1.1 development
- standard >= 0 development
- execjs ~> 2
- actions/checkout v2 composite
- actions/setup-node v1 composite
- ruby/setup-ruby v1 composite
- ruby 2.7 build
Score: 32.24694128332772