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: Then the following files should not exist:
| config.ru | | config.ru |
| Gemfile | | Gemfile |
And the file "config.rb" should contain "set :js_dir, 'js'"
Then a directory named "source" should exist Then a directory named "source" should exist
When I cd to "source" When I cd to "source"
Then the following files should exist: Then the following files should exist:

View file

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

View file

@ -36,13 +36,13 @@ module Middleman::Templates
class_option :template, :default => "default" class_option :template, :default => "default"
# What to call the directory which CSS will be searched for. # 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. # 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. # 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 # Output a config.ru file for Rack if --rack is passed
class_option :rack, :type => :boolean, :default => false class_option :rack, :type => :boolean, :default => false

View file

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

View file

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

View file

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