UNPKG

1.67 kBPlain TextView Raw
1lib_path = File.join(File.dirname(__FILE__), 'lib')
2$:.unshift(lib_path) unless $:.include?(lib_path)
3
4load './tasks/bower.rake'
5
6require 'rake/testtask'
7task :test do |t|
8 $: << File.expand_path('test/')
9 Dir.glob('./test/**/*_test.rb').each { |file| require file }
10end
11
12desc 'Dumps output to a CSS file for testing'
13task :debug do
14 require 'sass'
15 path = Bootstrap.stylesheets_path
16 %w(bootstrap).each do |file|
17 engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
18 File.open("./#{file}.css", 'w') { |f| f.write(engine.render) }
19 end
20end
21
22desc 'Convert bootstrap to bootstrap-sass'
23task :convert, :branch do |t, args|
24 require './tasks/converter'
25 Converter.new(branch: args[:branch]).process_bootstrap
26end
27
28desc 'LESS to stdin -> Sass to stdout'
29task :less_to_scss, :branch do |t, args|
30 require './tasks/converter'
31 puts Converter.new(branch: args[:branch]).convert_less(STDIN.read)
32end
33
34desc 'Compile bootstrap-sass to tmp/ (or first arg)'
35task :compile, :css_path do |t, args|
36 require 'sass'
37 require 'term/ansicolor'
38
39 path = 'assets/stylesheets'
40 css_path = args.with_defaults(css_path: 'tmp')[:css_path]
41 puts Term::ANSIColor.bold "Compiling SCSS in #{path}"
42 Dir.mkdir(css_path) unless File.directory?(css_path)
43 %w(bootstrap bootstrap/_theme).each do |file|
44 save_path = "#{css_path}/#{file.sub(/(^|\/)?_+/, '\1').sub('/', '-')}.css"
45 puts Term::ANSIColor.cyan(" #{save_path}") + '...'
46 engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
47 css = engine.render
48 File.open(save_path, 'w') { |f| f.write css }
49 end
50end
51
52task default: :test