Authored by 毕凯

compass 增加 autoprefixer 配置

1 require 'compass/import-once/activate' 1 require 'compass/import-once/activate'
  2 +
  3 +# autoprefixer自动加浏览器前缀
  4 +# 需要先安装, gem install autoprefixer-rails
  5 +
  6 +# require 'autoprefixer-rails'
  7 +#
  8 +# on_stylesheet_saved do |file|
  9 +# css = File.read(file)
  10 +# map = file + '.map'
  11 +# browsers = ['> 1%', 'ie 8']
  12 +#
  13 +# if File.exists? map
  14 +# result = AutoprefixerRails.process(css,
  15 +# from: file,
  16 +# to: file,
  17 +# browsers: browsers,
  18 +# map: { prev: File.read(map), inline: false })
  19 +# File.open(file, 'w') { |io| io << result.css }
  20 +# File.open(map, 'w') { |io| io << result.map }
  21 +# else
  22 +# File.open(file, 'w') { |io| io << AutoprefixerRails.process(css, browsers) }
  23 +# end
  24 +# end
  25 +
2 # Require any additional compass plugins here. 26 # Require any additional compass plugins here.
3 27
4 # Set this to the root of your project when deployed: 28 # Set this to the root of your project when deployed: