compass/doc-src/Rules

134 lines
2.5 KiB
Plaintext
Raw Normal View History

2010-01-21 06:25:44 +00:00
#!/usr/bin/env ruby
require 'compass'
2010-01-31 17:43:19 +00:00
Compass.add_configuration "#{File.dirname(__FILE__)}/.compass/config.rb"
2010-01-21 06:25:44 +00:00
SITE_ROOT = ""
2010-01-28 09:11:42 +00:00
compile '/assets/*/' do
2010-01-24 09:34:05 +00:00
nil
end
['markup', 'stylesheet', 'background'].each do |ex_file|
compile "/examples/*/#{ex_file}/" do
2010-03-28 09:49:58 +00:00
nil
end
2010-01-27 06:08:13 +00:00
end
compile '/' do
filter :haml, :ugly => true
2010-12-18 22:29:12 +00:00
layout item[:layout] ? item[:layout] : "main"
end
compile '/search-data/' do
filter :erb
end
2010-01-27 06:08:13 +00:00
compile '/examples/*/' do
filter :haml, :ugly => true
filter :highlight
2010-12-18 22:29:12 +00:00
layout item[:layout] ? item[:layout] : "example"
2010-01-27 06:08:13 +00:00
end
sass_options = Compass.sass_engine_options
(0..5).each do |i|
compile("/stylesheets/#{'*/' * i}_*/") {nil}
end
compile '/stylesheets/*' do
filter :sass, sass_options.merge(:syntax => item[:extension].to_sym)
2010-01-21 06:25:44 +00:00
end
2010-02-07 21:58:52 +00:00
compile '/reference/*/' do
filter :haml, :ugly => true
filter :highlight
2010-12-18 22:29:12 +00:00
layout item[:layout] ? item[:layout] : "main"
2010-02-07 21:58:52 +00:00
end
2011-04-17 08:48:44 +00:00
compile '/posts/*/' do
filter :erb
filter :rdiscount if item[:extension] == "markdown"
layout 'post'
end
compile "/blog/atom/" do
filter :haml, :attr_wrapper => '"'
end
2011-04-29 03:44:47 +00:00
compile 'sitemap' do
filter :erb
end
2010-01-21 06:25:44 +00:00
compile '*' do
if item[:extension] == "markdown"
filter :rdiscount
elsif item[:extension] == "haml"
filter :haml, :ugly => true
end
2010-12-18 22:29:12 +00:00
layout item[:layout] ? item[:layout] : "main"
2010-01-21 06:25:44 +00:00
end
2011-04-29 03:44:47 +00:00
route 'sitemap' do
item.identifier.chop + '.xml'
end
2011-04-17 08:48:44 +00:00
route "/blog/atom/" do
"/blog/atom.xml"
end
route '/search-data/' do
"#{SITE_ROOT}/javascripts"+item.identifier[0..-2]+".js"
end
(0..5).each do |i|
route("/stylesheets/#{'*/' * i}_*/") {nil}
2010-01-21 06:25:44 +00:00
end
2010-01-23 09:08:00 +00:00
route '/assets/htaccess/' do
"#{SITE_ROOT}/.htaccess"
end
route '/assets/css/*/' do
2010-01-28 09:11:42 +00:00
"#{SITE_ROOT}/stylesheets"+item.identifier.chop[11..-1]+"."+item[:extension]
2010-01-23 09:08:00 +00:00
end
route '/assets/images/*/' do
2010-01-28 09:11:42 +00:00
SITE_ROOT+item.identifier.chop[7..-1]+"."+item[:extension]
2010-01-24 09:34:05 +00:00
end
route '/assets/javascripts/*/' do
2010-01-28 09:11:42 +00:00
SITE_ROOT+item.identifier.chop[7..-1]+"."+item[:extension]
2010-01-23 09:08:00 +00:00
end
2010-03-29 06:53:57 +00:00
route '/assets/fonts/*/' do
SITE_ROOT+item.identifier.chop[7..-1]+"."+item[:extension]
end
2010-01-21 06:25:44 +00:00
route '/stylesheets/*/' do
# don't generate a directory like we do for HTML files
2010-01-28 09:11:42 +00:00
SITE_ROOT+item.identifier.chop + '.css'
2010-01-21 06:25:44 +00:00
end
2011-04-17 08:48:44 +00:00
route '/posts/*/' do
if item.identifier =~ %r{^/posts/(\d{4})-(\d{2})-(\d{2})-(.*)/$}
"/blog/#{$1}/#{$2}/#{$3}/#{$4}/index.html"
else
puts "WARNING: malformed post name: #{item.identifier}"
nil
end
end
2010-04-21 05:43:25 +00:00
%w(markup stylesheet background).each do |ex_file|
route "/examples/*/#{ex_file}/" do
2010-03-28 09:49:58 +00:00
nil
end
2010-01-27 06:08:13 +00:00
end
2010-01-21 06:25:44 +00:00
route '*' do
2010-01-28 09:11:42 +00:00
SITE_ROOT+item.identifier + 'index.html'
2010-01-21 06:25:44 +00:00
end
2010-01-23 02:15:04 +00:00
layout '*', :haml, :ugly => true