Created
February 5, 2012 17:32
-
-
Save noniq/1746744 to your computer and use it in GitHub Desktop.
Script for building a single giant compass-all.scss file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# ruby concat.rb /path-to-compass-gem/frameworks/compass/stylesheets/_compass.scss > compass-all.scss | |
@seen = [] | |
def concat(file) | |
File.foreach(file) do |line| | |
if line =~ /^\s?@import "(.+?)";/ | |
import = $1 | |
unless @seen.include?(import) | |
@seen << import | |
puts "// IMPORTING #{import}" | |
import_filename = import.gsub(%r{([^/]+)$}, '_\1.scss') | |
import_path = File.exist?(File.dirname(file) + "/" + import_filename) ? File.dirname(file) : @basedir | |
concat("#{import_path}/" + import_filename) | |
end | |
else | |
puts line | |
end | |
end | |
end | |
@basedir = File.dirname(File.expand_path(ARGV[0])) | |
concat ARGV[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're interested in a quick and dirty benchmark, I just compared the following grunt setups:
Before: grunt-contrib-compass / @include "compass/compass":
Completed in 3.966s …
Completed in 3.924s …
Completed in 4.013s …
Bypass lib but compile with compass: grunt-contrib-compass / @include "vendor/compass-all":
Completed in 2.899s …
Completed in 3.098s …
Completed in 2.899s …
Use SASS, bypass compass completely: grunt-contrib-sass / @include "vendor/compass-all":
Completed in 0.866s …
Completed in 0.816s …
Completed in 0.834s …
Thank you so much!