1
0
Fork 0
mirror of https://github.com/twbs/bootstrap-sass.git synced 2022-11-09 12:27:02 -05:00
twbs--bootstrap-sass/Rakefile

53 lines
1.6 KiB
Text
Raw Normal View History

2014-05-01 07:59:10 +02:00
lib_path = File.join(File.dirname(__FILE__), 'lib')
$:.unshift(lib_path) unless $:.include?(lib_path)
load './tasks/bower.rake'
require 'rake/testtask'
2014-08-24 22:46:13 +02:00
task :test do |t|
$: << File.expand_path('test/')
Dir.glob('./test/**/*_test.rb').each { |file| require file }
end
desc 'Dumps output to a CSS file for testing'
task :debug do
require 'sass'
2013-11-14 18:26:08 +01:00
path = Bootstrap.stylesheets_path
2013-04-13 15:59:28 +01:00
%w(bootstrap).each do |file|
2013-01-20 14:48:46 +00:00
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
File.open("./#{file}.css", 'w') { |f| f.write(engine.render) }
end
end
desc 'Convert bootstrap to bootstrap-sass'
task :convert, :branch do |t, args|
require './tasks/converter'
Converter.new(branch: args[:branch]).process_bootstrap
end
desc 'LESS to stdin -> Sass to stdout'
task :less_to_scss, :branch do |t, args|
require './tasks/converter'
puts Converter.new(branch: args[:branch]).convert_less(STDIN.read)
end
2013-08-18 20:34:36 +02:00
desc 'Compile bootstrap-sass to tmp/ (or first arg)'
task :compile, :css_path do |t, args|
require 'sass'
require 'term/ansicolor'
2014-06-24 02:57:06 +02:00
path = 'assets/stylesheets'
css_path = args.with_defaults(css_path: 'tmp')[:css_path]
2013-08-18 20:34:36 +02:00
puts Term::ANSIColor.bold "Compiling SCSS in #{path}"
Dir.mkdir(css_path) unless File.directory?(css_path)
2013-08-18 20:34:36 +02:00
%w(bootstrap bootstrap/_theme).each do |file|
save_path = "#{css_path}/#{file.sub(/(^|\/)?_+/, '\1').sub('/', '-')}.css"
2013-08-18 20:34:36 +02:00
puts Term::ANSIColor.cyan(" #{save_path}") + '...'
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
css = engine.render
File.open(save_path, 'w') { |f| f.write css }
end
end
task default: :test