@@ -2,7 +2,7 @@ require 'rake/testtask'
2
2
Rake ::TestTask . new do |t |
3
3
t . libs << "test"
4
4
t . test_files = FileList [ 'test/*_test.rb' ]
5
- t . verbose = true
5
+ t . verbose = true
6
6
end
7
7
8
8
desc 'Dumps output to a CSS file for testing'
@@ -24,4 +24,25 @@ task :convert, :branch do |t, args|
24
24
Converter . new ( branch ) . process
25
25
end
26
26
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
+
27
48
task default : :test
0 commit comments