Class: Middleman::Templates::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/middleman-core/templates/default.rb

Overview

Default Middleman template

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

gemfile_template, #generate_bundler!, #generate_gitignore!, #generate_rack!, #initialize

Constructor Details

This class inherits a constructor from Middleman::Templates::Base

Class Method Details

.source_rootString

Template files are relative to this file

Returns:

  • (String)


15
16
17
# File 'lib/middleman-core/templates/default.rb', line 15

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#build_scaffold!

This method returns an undefined value.

Actually output the files



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/middleman-core/templates/default.rb', line 21

def build_scaffold!
  template 'shared/config.tt', File.join(location, 'config.rb'), force: options[:force]
  copy_file 'default/source/index.html.erb', File.join(location, 'source/index.html.erb'), force: options[:force]
  copy_file 'default/source/layouts/layout.erb', File.join(location, 'source/layouts/layout.erb'), force: options[:force]
  empty_directory File.join(location, 'source', options[:css_dir]), force: options[:force]
  copy_file 'default/source/stylesheets/all.css', File.join(location, 'source', options[:css_dir], 'all.css'), force: options[:force]
  copy_file 'default/source/stylesheets/normalize.css', File.join(location, 'source', options[:css_dir], 'normalize.css'), force: options[:force]
  empty_directory File.join(location, 'source', options[:js_dir]), force: options[:force]
  copy_file 'default/source/javascripts/all.js', File.join(location, 'source', options[:js_dir], 'all.js'), force: options[:force]
  empty_directory File.join(location, 'source', options[:images_dir]), force: options[:force]
  copy_file 'default/source/images/background.png', File.join(location, 'source', options[:images_dir], 'background.png'), force: options[:force]
  copy_file 'default/source/images/middleman.png', File.join(location, 'source', options[:images_dir], 'middleman.png'), force: options[:force]
end