1 | lib_path = File.join(File.dirname(__FILE__), 'lib')
|
2 | $:.unshift(lib_path) unless $:.include?(lib_path)
|
3 |
|
4 | load './tasks/bower.rake'
|
5 |
|
6 | require 'rake/testtask'
|
7 | task :test do |t|
|
8 | $: << File.expand_path('test/')
|
9 | Dir.glob('./test/**/*_test.rb').each { |file| require file }
|
10 | end
|
11 |
|
12 | desc 'Dumps output to a CSS file for testing'
|
13 | task :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
|
20 | end
|
21 |
|
22 | desc 'Convert bootstrap to bootstrap-sass'
|
23 | task :convert, :branch do |t, args|
|
24 | require './tasks/converter'
|
25 | Converter.new(branch: args[:branch]).process_bootstrap
|
26 | end
|
27 |
|
28 | desc 'LESS to stdin -> Sass to stdout'
|
29 | task :less_to_scss, :branch do |t, args|
|
30 | require './tasks/converter'
|
31 | puts Converter.new(branch: args[:branch]).convert_less(STDIN.read)
|
32 | end
|
33 |
|
34 | desc 'Compile bootstrap-sass to tmp/ (or first arg)'
|
35 | task :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
|
50 | end
|
51 |
|
52 | task default: :test
|