diff options
author | Carlos Diaz-Padron <carlos@carlosdp.io> | 2014-03-20 05:53:27 +0400 |
---|---|---|
committer | Carlos Diaz-Padron <carlos@carlosdp.io> | 2014-03-20 05:53:27 +0400 |
commit | c624370acb30b071054db4ebc277225479736aab (patch) | |
tree | f0392c6689f5ae227d11004679aecea7129c9514 /Rakefile | |
parent | 5db7be8e096b259c4f517d23ece1100384b79a70 (diff) |
Create directory from argument in compile task
Previously, the compile task would always create a tmp/ directory, even
if another directory is specified. The specified directory was also not
created if necessary.
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -37,13 +37,14 @@ task :compile, :css_path do |t, args| require 'term/ansicolor' path = 'vendor/assets/stylesheets' + css_path = args.with_defaults(css_path: 'tmp')[:css_path] puts Term::ANSIColor.bold "Compiling SCSS in #{path}" + Dir.mkdir(css_path) unless File.directory?(css_path) %w(bootstrap bootstrap/_theme).each do |file| - save_path = "#{args.with_defaults(css_path: 'tmp')[:css_path]}/#{file.sub(/(^|\/)?_+/, '\1').sub('/', '-')}.css" + save_path = "#{css_path}/#{file.sub(/(^|\/)?_+/, '\1').sub('/', '-')}.css" puts Term::ANSIColor.cyan(" #{save_path}") + '...' engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path]) css = engine.render - Dir.mkdir('tmp') unless File.directory?('tmp') File.open(save_path, 'w') { |f| f.write css } end end |