datamad2017/_sass/config.rb

44 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

require 'sass-media_query_combiner'
require 'autoprefixer-rails'
2014-08-14 23:27:17 +02:00
require "./remove-all-comments-monkey-patch"
on_stylesheet_saved do |file|
css = File.read(file)
File.open(file, 'w') do |io|
io << AutoprefixerRails.process(css, browsers: ["last 2 version", "> 1%"])
end
end
http_path = "/"
css_dir = "../css"
sass_dir = "./"
images_dir = "../img"
javascripts_dir = "../js"
2014-08-14 23:27:17 +02:00
if environment == :development
line_comments = true
relative_assets = true
output_style = :expanded
end
if environment == :production
line_comments = false
relative_assets = true
output_style = :compressed
require 'fileutils'
on_stylesheet_saved do |file|
if File.exists?(file)
filename = File.basename(file, File.extname(file))
File.rename(file, "../css" + "/" + filename + ".min" + File.extname(file))
end
end
end
# Remove multiline comments - monkey patch
class Sass::Tree::Visitors::Perform < Sass::Tree::Visitors::Base
# Removes all comments completely
def visit_comment(node)
return []
end
end