Skip to content

Instantly share code, notes, and snippets.

@terry90
Created September 30, 2019 22:04
Show Gist options
  • Save terry90/4845ab17202dc3b8bc8f39884c972dc8 to your computer and use it in GitHub Desktop.
Save terry90/4845ab17202dc3b8bc8f39884c972dc8 to your computer and use it in GitHub Desktop.
medium_answer_build_scss
def compile_scss(compress = true)
puts cyan 'Compiling Sass files...'
files = Dir[File.join(__dir__, 'src/**/*.scss')].reject { |name| name.split("/").last[0] == '_'}
system(": > ./static/app.css")
files.each do |file|
compress ?
system("sass #{file} -s compressed | uglifycss >> ./static/app.css") :
system("sass #{file} >> ./static/app.css")
end
puts green 'Sass files compiled'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment