安裝SASS
安裝Ruby環境
安裝SASS
安裝Compass
安裝Autoprefixer
Encoding.default_external = 'utf-8'
sourcemap = true
cache = false
asset_cache_buster {|*args| nil }
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這樣就完成囉,可以去建立SASS專案囉~。
Last updated