Skip to content

Commit 07f9d01

Browse files
committedAug 18, 2013
rake compile will compile CSS to tmp/
1 parent 7050cd0 commit 07f9d01

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed
 

‎Rakefile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require 'rake/testtask'
22
Rake::TestTask.new do |t|
33
t.libs << "test"
44
t.test_files = FileList['test/*_test.rb']
5-
t.verbose = true
5+
t.verbose = true
66
end
77

88
desc 'Dumps output to a CSS file for testing'
@@ -24,4 +24,25 @@ task :convert, :branch do |t, args|
2424
Converter.new(branch).process
2525
end
2626

27+
desc 'Compile bootstrap-sass to tmp/ (or first arg)'
28+
task :compile, :css_path do |t, args|
29+
lib_path = File.join(File.dirname(__FILE__), 'lib')
30+
$:.unshift(lib_path) unless $:.include?(lib_path)
31+
require 'sass'
32+
require 'bootstrap-sass/compass_functions'
33+
require 'bootstrap-sass/sass_functions'
34+
require 'term/ansicolor'
35+
36+
path = 'vendor/assets/stylesheets'
37+
puts Term::ANSIColor.bold "Compiling SCSS in #{path}"
38+
%w(bootstrap bootstrap/_theme).each do |file|
39+
save_path = "#{args.with_defaults(css_path: 'tmp')[:css_path]}/#{file.sub(/(^|\/)?_+/, '\1').sub('/', '-')}.css"
40+
puts Term::ANSIColor.cyan(" #{save_path}") + '...'
41+
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
42+
css = engine.render
43+
File.mkdir('tmp') unless File.directory?('tmp')
44+
File.open(save_path, 'w') { |f| f.write css }
45+
end
46+
end
47+
2748
task default: :test

0 commit comments

Comments
 (0)