diff --git a/.gitignore b/.gitignore index 90614b617e..6af7b5468f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.DS_Store tmp/* -built_examples/* +examples/*/stylesheets/* +examples/*/*.html test/tmp test/fixtures/stylesheets/*/tmp test/fixtures/stylesheets/*/saved diff --git a/Rakefile b/Rakefile index 5a312b2d7e..708296a78c 100644 --- a/Rakefile +++ b/Rakefile @@ -63,49 +63,22 @@ task :examples do require 'haml' require 'sass' require 'pathname' + require 'lib/compass' + require 'lib/compass/exec' FileList['examples/*'].each do |example| - puts "Compiling #{example} -> built_examples/#{example.sub(%r{.*/},'')}" + puts "\nCompiling #{example}" + puts "=" * "Compiling #{example}".length # compile any haml templates to html FileList["#{example}/*.haml"].each do |haml_file| - basename = haml_file[9..-6] + basename = haml_file[0..-6] engine = Haml::Engine.new(open(haml_file).read, :filename => haml_file) - target_dir = "built_examples/#{basename.sub(%r{/[^/]*$},'')}" - FileUtils.mkdir_p(target_dir) - output = open("built_examples/#{basename}",'w') + puts " haml #{File.basename(basename)}" + output = open(basename,'w') output.write(engine.render) output.close end - # compile any sass templates to css - FileList["#{example}/stylesheets/**/[^_]*.sass"].each do |sass_file| - basename = sass_file[9..-6] - css_filename = "built_examples/#{basename}.css" - compass_sass = File.dirname(__FILE__).sub(%r{.*/},'') - engine = Sass::Engine.new(open(sass_file).read, - :filename => sass_file, - :line_comments => true, - :css_filename => css_filename, - :load_paths => ["#{example}/stylesheets"] + Compass::Frameworks::ALL.map{|f| f.stylesheets_directory}) - target_dir = "built_examples/#{basename.sub(%r{/[^/]*$},'')}" - FileUtils.mkdir_p(target_dir) - output = open(css_filename,'w') - output.write(engine.render) - output.close - end - # copy any other non-haml and non-sass files directly over - target_dir = "built_examples/#{example.sub(%r{.*/},'')}" - other_files = FileList["#{example}/**/*"] - other_files.exclude "**/*.sass", "**/*.haml" - other_files.each do |file| - - if File.directory?(file) - FileUtils.mkdir_p(file) - elsif File.file?(file) - target_file = "#{target_dir}/#{file[(example.size+1)..-1]}" - # puts "mkdir -p #{File.dirname(target_file)}" - FileUtils.mkdir_p(File.dirname(target_file)) - # puts "cp #{file} #{target_file}" - FileUtils.cp(file, target_file) - end + Dir.chdir example do + Compass::Exec::Compass.new([]).run! end end end diff --git a/examples/blueprint_default/stylesheets/ie.sass b/examples/blueprint_default/src/ie.sass similarity index 100% rename from examples/blueprint_default/stylesheets/ie.sass rename to examples/blueprint_default/src/ie.sass diff --git a/examples/blueprint_default/stylesheets/images/grid.png b/examples/blueprint_default/src/images/grid.png similarity index 100% rename from examples/blueprint_default/stylesheets/images/grid.png rename to examples/blueprint_default/src/images/grid.png diff --git a/examples/blueprint_default/stylesheets/print.sass b/examples/blueprint_default/src/print.sass similarity index 100% rename from examples/blueprint_default/stylesheets/print.sass rename to examples/blueprint_default/src/print.sass diff --git a/examples/blueprint_default/stylesheets/screen.sass b/examples/blueprint_default/src/screen.sass similarity index 100% rename from examples/blueprint_default/stylesheets/screen.sass rename to examples/blueprint_default/src/screen.sass diff --git a/examples/blueprint_plugins/stylesheets/ie.sass b/examples/blueprint_plugins/src/ie.sass similarity index 100% rename from examples/blueprint_plugins/stylesheets/ie.sass rename to examples/blueprint_plugins/src/ie.sass diff --git a/examples/blueprint_plugins/stylesheets/images/grid.png b/examples/blueprint_plugins/src/images/grid.png similarity index 100% rename from examples/blueprint_plugins/stylesheets/images/grid.png rename to examples/blueprint_plugins/src/images/grid.png diff --git a/examples/blueprint_plugins/stylesheets/print.sass b/examples/blueprint_plugins/src/print.sass similarity index 100% rename from examples/blueprint_plugins/stylesheets/print.sass rename to examples/blueprint_plugins/src/print.sass diff --git a/examples/blueprint_plugins/stylesheets/screen.sass b/examples/blueprint_plugins/src/screen.sass similarity index 100% rename from examples/blueprint_plugins/stylesheets/screen.sass rename to examples/blueprint_plugins/src/screen.sass diff --git a/examples/blueprint_scoped/stylesheets/ie.sass b/examples/blueprint_scoped/src/ie.sass similarity index 100% rename from examples/blueprint_scoped/stylesheets/ie.sass rename to examples/blueprint_scoped/src/ie.sass diff --git a/examples/blueprint_scoped/stylesheets/print.sass b/examples/blueprint_scoped/src/print.sass similarity index 100% rename from examples/blueprint_scoped/stylesheets/print.sass rename to examples/blueprint_scoped/src/print.sass diff --git a/examples/blueprint_scoped/stylesheets/screen.sass b/examples/blueprint_scoped/src/screen.sass similarity index 100% rename from examples/blueprint_scoped/stylesheets/screen.sass rename to examples/blueprint_scoped/src/screen.sass diff --git a/examples/blueprint_scoped_form/stylesheets/ie.sass b/examples/blueprint_scoped_form/src/ie.sass similarity index 100% rename from examples/blueprint_scoped_form/stylesheets/ie.sass rename to examples/blueprint_scoped_form/src/ie.sass diff --git a/examples/blueprint_scoped_form/stylesheets/print.sass b/examples/blueprint_scoped_form/src/print.sass similarity index 100% rename from examples/blueprint_scoped_form/stylesheets/print.sass rename to examples/blueprint_scoped_form/src/print.sass diff --git a/examples/blueprint_scoped_form/stylesheets/screen.sass b/examples/blueprint_scoped_form/src/screen.sass similarity index 100% rename from examples/blueprint_scoped_form/stylesheets/screen.sass rename to examples/blueprint_scoped_form/src/screen.sass diff --git a/examples/blueprint_semantic/stylesheets/ie.sass b/examples/blueprint_semantic/src/ie.sass similarity index 100% rename from examples/blueprint_semantic/stylesheets/ie.sass rename to examples/blueprint_semantic/src/ie.sass diff --git a/examples/blueprint_semantic/stylesheets/images/grid.png b/examples/blueprint_semantic/src/images/grid.png similarity index 100% rename from examples/blueprint_semantic/stylesheets/images/grid.png rename to examples/blueprint_semantic/src/images/grid.png diff --git a/examples/blueprint_semantic/stylesheets/liquid.sass b/examples/blueprint_semantic/src/liquid.sass similarity index 100% rename from examples/blueprint_semantic/stylesheets/liquid.sass rename to examples/blueprint_semantic/src/liquid.sass diff --git a/examples/blueprint_semantic/stylesheets/print.sass b/examples/blueprint_semantic/src/print.sass similarity index 100% rename from examples/blueprint_semantic/stylesheets/print.sass rename to examples/blueprint_semantic/src/print.sass diff --git a/examples/blueprint_semantic/stylesheets/screen.sass b/examples/blueprint_semantic/src/screen.sass similarity index 100% rename from examples/blueprint_semantic/stylesheets/screen.sass rename to examples/blueprint_semantic/src/screen.sass diff --git a/examples/compass/stylesheets/compass.sass b/examples/compass/src/compass.sass similarity index 100% rename from examples/compass/stylesheets/compass.sass rename to examples/compass/src/compass.sass diff --git a/examples/compass/stylesheets/images/blue_arrow.gif b/examples/compass/src/images/blue_arrow.gif similarity index 100% rename from examples/compass/stylesheets/images/blue_arrow.gif rename to examples/compass/src/images/blue_arrow.gif diff --git a/examples/compass/stylesheets/sticky_footer.sass b/examples/compass/src/sticky_footer.sass similarity index 100% rename from examples/compass/stylesheets/sticky_footer.sass rename to examples/compass/src/sticky_footer.sass diff --git a/examples/compass/stylesheets/utilities.sass b/examples/compass/src/utilities.sass similarity index 100% rename from examples/compass/stylesheets/utilities.sass rename to examples/compass/src/utilities.sass diff --git a/examples/yui/stylesheets/screen.sass b/examples/yui/src/screen.sass similarity index 100% rename from examples/yui/stylesheets/screen.sass rename to examples/yui/src/screen.sass