diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2013-08-18 22:34:36 +0400 |
---|---|---|
committer | Gleb Mazovetskiy <glex.spb@gmail.com> | 2013-08-18 22:34:36 +0400 |
commit | 07f9d01b559327c0587ec52784170e7ab3b147b5 (patch) | |
tree | 8c1ead40d04aa19f4f424dbaec82ea7a862db526 /Rakefile | |
parent | 7050cd0e9ae71f37f2161895927b776812b02512 (diff) |
rake compile will compile CSS to tmp/
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -2,7 +2,7 @@ require 'rake/testtask' Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList['test/*_test.rb'] - t.verbose = true + t.verbose = true end desc 'Dumps output to a CSS file for testing' @@ -24,4 +24,25 @@ task :convert, :branch do |t, args| Converter.new(branch).process end +desc 'Compile bootstrap-sass to tmp/ (or first arg)' +task :compile, :css_path do |t, args| + lib_path = File.join(File.dirname(__FILE__), 'lib') + $:.unshift(lib_path) unless $:.include?(lib_path) + require 'sass' + require 'bootstrap-sass/compass_functions' + require 'bootstrap-sass/sass_functions' + require 'term/ansicolor' + + path = 'vendor/assets/stylesheets' + puts Term::ANSIColor.bold "Compiling SCSS in #{path}" + %w(bootstrap bootstrap/_theme).each do |file| + save_path = "#{args.with_defaults(css_path: 'tmp')[: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 + File.mkdir('tmp') unless File.directory?('tmp') + File.open(save_path, 'w') { |f| f.write css } + end +end + task default: :test |