make sure html5 template has correct paths setup. Fixes #291

This commit is contained in:
Thomas Reynolds 2012-03-03 16:40:03 -08:00
parent a6d099c4a0
commit 410b6b37d1
6 changed files with 33 additions and 17 deletions

View file

@ -55,6 +55,7 @@ Feature: Middleman CLI
Then the following files should not exist:
| config.ru |
| Gemfile |
And the file "config.rb" should contain "set :js_dir, 'js'"
Then a directory named "source" should exist
When I cd to "source"
Then the following files should exist:

View file

@ -14,13 +14,13 @@ module Middleman::Cli
:default => "default",
:desc => "Use a project template: #{available_templates}"
method_option "css_dir",
:default => "stylesheets",
# :default => "stylesheets",
:desc => 'The path to the css files'
method_option "js_dir",
:default => "javascripts",
# :default => "javascripts",
:desc => 'The path to the javascript files'
method_option "images_dir",
:default => "images",
# :default => "images",
:desc => 'The path to the image files'
method_option "rack",
:type => :boolean,

View file

@ -36,13 +36,13 @@ module Middleman::Templates
class_option :template, :default => "default"
# What to call the directory which CSS will be searched for.
class_option :css_dir, :default => "stylesheets"
class_option :css_dir#, :default => "stylesheets"
# What to call the directory which JS will be searched for.
class_option :js_dir, :default => "javascripts"
class_option :js_dir#, :default => "javascripts"
# What to call the directory which images will be searched for.
class_option :images_dir, :default => "images"
class_option :images_dir#, :default => "images"
# Output a config.ru file for Rack if --rack is passed
class_option :rack, :type => :boolean, :default => false

View file

@ -1,6 +1,16 @@
# Default Middleman template
class Middleman::Templates::Default < 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'
# Template files are relative to this file
# @return [String]
def self.source_root

View file

@ -1,11 +1,16 @@
# HTML5 Boilerplate template
class Middleman::Templates::Html5 < Middleman::Templates::Base
# Has different default paths
class_option :css_dir, :default => "css"
class_option :js_dir, :default => "js"
class_option :images_dir, :default => "img"
class_option "css_dir",
:default => "css",
:desc => 'The path to the css files'
class_option "js_dir",
:default => "js",
:desc => 'The path to the javascript files'
class_option "images_dir",
:default => "img",
:desc => 'The path to the image files'
# Templates are relative to this file
# @return [String]
def self.source_root

View file

@ -47,22 +47,22 @@
# end
# end
<% if options[:css_dir] != "stylesheets" -%>
set :css_dir, "<%= options[:css_dir] -%>"
<% if options[:css_dir] -%>
set :css_dir, '<%= options[:css_dir] -%>'
<% else -%>
# Change the CSS directory
# set :css_dir, "alternative_css_directory"
<% end -%>
<% if options[:js_dir] != "javascripts" -%>
set :js_dir, "<%= options[:js_dir] -%>"
<% if options[:js_dir] -%>
set :js_dir, '<%= options[:js_dir] -%>'
<% else -%>
# Change the JS directory
# set :js_dir, "alternative_js_directory"
<% end -%>
<% if options[:images_dir] != "images" -%>
set :images_dir, "<%= options[:images_dir] -%>"
<% if options[:images_dir] -%>
set :images_dir, '<%= options[:images_dir] -%>'
<% else -%>
# Change the images directory
# set :images_dir, "alternative_image_directory"