Sha256: dc06b47f4f7f906aabec6314e7aff99dd939028e625d76eca452a687bbe000ad

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

require 'middleman-core/templates'

module Middleman
  module Tansu

    class Template < Middleman::Templates::Base
      class_option 'css_dir',
        default: 'stylesheets',
        desc: 'The path to the css files'
      class_option 'js_dir',
        default: 'javascripts',
        desc: 'The path to the javascript files'
      class_option 'images_dir',
        default: 'images',
        desc: 'The path to the image files'

      def self.source_root
        File.join(File.dirname(__FILE__), 'template')
      end

      def build_scaffold!
        template 'shared/Gemfile.tt', File.join(location, 'Gemfile')
        template 'shared/config.tt', File.join(location, 'config.rb')

        empty_directory File.join(location, 'source', options[:css_dir])
        empty_directory File.join(location, 'source', options[:js_dir])
        empty_directory File.join(location, 'source', options[:images_dir])
        empty_directory File.join(location, 'source', 'templates')
        empty_directory File.join(location, 'source', 'layouts')

        copy_file 'source/sample.html.md', File.join(location, 'source/sample.html.md')
        copy_file 'source/sitemap.xml.builder', File.join(location, 'source/sitemap.xml.builder')
        copy_file 'source/layouts/layout.slim', File.join(location, 'source/layouts/layout.slim')
        copy_file 'source/templates/index.html.slim', File.join(location, 'source/templates/index.html.slim')
        copy_file 'source/stylesheets/all.css.sass', File.join(location, 'source', options[:css_dir], 'all.css.sass')
        copy_file 'source/stylesheets/github-markdown.css', File.join(location, 'source', options[:css_dir], 'github-markdown.css')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-tansu-0.0.4 lib/middleman-tansu/template.rb
middleman-tansu-0.0.3 lib/middleman-tansu/template.rb