jcpunk / centos / centos.org

Forked from centos/centos.org 8 days ago
Clone
Blob Blame History Raw
#!/usr/bin/env ruby

## Required Gems
require 'compass'
require 'susy'

### Compass configuration ####################################################
Compass.add_project_configuration 'config.rb'
sass_options = Compass.sass_engine_options

### Configuration ############################################################
TypographicalImprovementFilter = :rubypants
TypographicalImprovementFilterParams = {}

### Preprocessing ############################################################
preprocess do
  config[:nanoc_version_info] = `nanoc --version`.strip
  config[:gem_version_info]   = `gem --version`.strip
end

### Routing ##################################################################
route '/static/*' do
  # /static/foo.html/ → /foo.html
  item.identifier[7..-2]
end

route 'sitemap' do
  item.identifier.chop + '.xml'
end


route '/assets/css/bootstrap/_*/' do
  # Don't output partials, so return nil
  nil
end

route '/assets/css/*/' do
  # path with version
  '/assets/style' + '-v' + rep.item[:version].to_s + '.css'
end

route '*' do
  if item.binary?
    item.identifier.chop + '.' + item[:extension]
  elsif item[:is_partial] || item[:kind] == 'article'
    # Don’t output partial items (e.g. sub-stylesheets)
    nil
  elsif item[:path]
    item[:path]
  else
    # Place each file in its own directory
    rep.item.identifier + 'index.html'
  end
end


### Compilation ##############################################################

compile 'sitemap' do
  filter :erb
end

compile '/assets/css/bootstrap/_*/' do
  # Don’t compile partials
end

compile '/assets/css/*/' do
  filter :sass, Compass.sass_engine_options
  filter :relativize_paths, :type => :css
  filter :rainpress
end
compile '/static/*' do
end

compile '*' do 
  if item.binary?
    # ha, do nothing! :)
  else
    puts "item = #{item.identifier} -- extension = #{item[:extension]}"
    case item[:extension]
    when 'md'
      filter :erb
      filter :kramdown
    when 'haml'
      filter :erb
      filter :haml
    when 'js'
      filter :erb
      filter :uglify_js
    when 'adoc'
      filter :asciidoc
    else
      filter :erb
    end
  layout 'default-haml' unless item[:extension] == 'js' 
  filter :add_ids_to_headers
  filter TypographicalImprovementFilter, TypographicalImprovementFilterParams
  end
end
### Layouting ################################################################


layout '*', :haml