Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Compile .x.css files with extended format content

  • Loading branch information...
commit 0bf9839bbe5590b18d7843592b2a01aa1a3c2452 1 parent 1b05f7e
@ELLIOTTCABLE authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 Rakefile.rb
View
21 Rakefile.rb
@@ -17,13 +17,14 @@
puts 'SASS updated!'
else
puts 'SASS update failed'
+ exit
end
end
desc 'Clear compiled CSS files'
-task :clear do
+task :clobber do
puts 'Clearing CSS...'
- Dir['./compiled/*.css'].each do |file|
+ Dir['./compiled/**.css'].each do |file|
File.delete file
print "#{File.basename(file)} deleted, "
end
@@ -31,15 +32,23 @@
end
desc 'Compile SASS templates to CSS'
-task :compile => [:clear] do
+task :compile => [:clobber] do
puts 'Compiling SASS...'
Dir['./*.sass'].each do |sass_filename|
File.open(sass_filename, 'r') do |sass_file|
+ content = sass_file.read
+
css_filename = sass_filename.gsub('.sass','.css').gsub('./','./compiled/')
File.open(css_filename,'w') do |css_file|
- css_file << Sass::Engine.new(sass_file.read, :style => :compressed, :filename => sass_filename.to_s, :load_paths => ['.']).to_css
- puts " - #{File.basename(sass_filename)} compiled to #{File.basename(css_file.path)}"
+ css_file << Sass::Engine.new(content, :style => :compressed, :filename => sass_filename.to_s, :load_paths => ['.']).to_css
end
+
+ xcss_filename = sass_filename.gsub('.sass','.x.css').gsub('./','./compiled/')
+ File.open(xcss_filename,'w') do |xcss_file|
+ xcss_file << Sass::Engine.new(content, :style => :nested, :filename => sass_filename.to_s, :load_paths => ['.']).to_css
+ end
+
+ puts " - #{File.basename(sass_filename)} compiled to #{File.basename(css_filename)} & #{File.basename(xcss_filename)}"
end
end
puts 'SASS compiled!'
@@ -50,7 +59,7 @@
Dir['./includes/*.sass'].each do |sass_filename|
File.open(sass_filename, 'r') do |sass_file|
begin
- Sass::Engine.new(sass_file.read, :style => :compressed, :filename => sass_filename.to_s, :load_paths => ['.']).to_css
+ Sass::Engine.new(sass_file.read, :style => :nested, :filename => sass_filename.to_s, :load_paths => ['.']).to_css
rescue Exception => e
puts "#{sass_filename} raised #{e.inspect}"
end
Please sign in to comment.
Something went wrong with that request. Please try again.