Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ticolucci/6308424 to your computer and use it in GitHub Desktop.
Save ticolucci/6308424 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'fssm'
$from_path = ARGV[0] || "src"
$to_path = ARGV[1] || "bin"
def update_haml base, relative
puts relative
input = File.join(base, relative)
output = File.join(File.dirname(base), $to_path, relative.gsub!('.haml', '.html'))
command = "haml #{input} #{output} -f xhtml -t ugly --no-escape-attrs"
puts `#{command}`
puts <<-eos
HTML gerado #{Time.now.strftime("%Y/%m/%d %H:%M")}:
- from: #{input}
- to: #{output}
eos
end
def update_sass base, relative
puts relative
input = File.join(base, relative)
command = "compass compile . #{input} -c config.rb"
puts `#{command}`
end
$dir = File.join(File.dirname(__FILE__), $from_path)
FSSM.monitor do
path $dir do
glob '**/*.haml'
update do |base, relative|
update_haml base, relative
end
end
path File.join($dir, "sass/") do
glob '**/*.sass'
update do |base, relative|
update_sass base, relative
end
end
end
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "bin/stylesheets"
sass_dir = "src/sass"
images_dir = "bin/images"
javascripts_dir = "bin/javascripts"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment