1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

new default template thanks to @evenwu

This commit is contained in:
Thomas Reynolds 2011-12-23 10:55:25 -08:00
parent 4f78ecf367
commit 557aae372b
15 changed files with 547 additions and 105 deletions

View file

@ -1,8 +1,16 @@
Feature: Generator
In order to generate static assets for client
Scenario: Copying template files
Given a project at "generator-test"
And the project has been initialized
Then template files should exist
And empty directories should exist
Given I run `middleman init generator-test`
Then the exit status should be 0
When I cd to "generator-test"
Then the following files should exist:
| config.rb |
| source/index.html.erb |
| source/images/background.png |
| source/images/middleman.png |
| source/layouts/layout.erb |
| source/javascripts/all.js |
| source/stylesheets/all.css.scss |
| source/stylesheets/_animate.scss |
| source/stylesheets/_normalize.scss |

View file

@ -5,7 +5,6 @@ ENV['PATH'] = "#{MIDDLEMAN_BIN_PATH}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
require "aruba/cucumber"
require "middleman/step_definitions/middleman_steps"
require "middleman/step_definitions/builder_steps"
require "middleman/step_definitions/generator_steps"
require "middleman/step_definitions/server_steps"
Before do

View file

@ -1,26 +0,0 @@
require 'fileutils'
Given /^the project has been initialized$/ do
step %Q{the project should be cleaned up}
init_cmd = File.join(MIDDLEMAN_BIN_PATH, "middleman init")
`cd #{File.dirname(@target)} && #{init_cmd} #{File.basename(@target)}`
end
Then /^template files should exist$/ do
template_glob = File.join(MIDDLEMAN_ROOT_PATH, "lib", "middleman", "templates", "default", "*/**/*")
Dir[template_glob].each do |f|
next if File.directory?(f)
File.exists?("#{@target}/#{f.split('template/')[1]}").should be_true
end
end
Then /^empty directories should exist$/ do
%w(source/stylesheets source/javascripts source/images).each do |d|
File.exists?("#{@target}/#{d}").should be_true
end
end
Then /^the project should be cleaned up$/ do
FileUtils.rm_rf(@target)
end

View file

@ -12,11 +12,16 @@ class Middleman::Templates::Default < Middleman::Templates::Base
def build_scaffold!
template "shared/config.tt", File.join(location, "config.rb")
copy_file "default/source/index.html.erb", File.join(location, "source/index.html.erb")
copy_file "default/source/layout.erb", File.join(location, "source/layout.erb")
copy_file "default/source/layouts/layout.erb", File.join(location, "source/layouts/layout.erb")
empty_directory File.join(location, "source", options[:css_dir])
copy_file "default/source/stylesheets/site.css.scss", File.join(location, "source", options[:css_dir], "site.css.scss")
copy_file "default/source/stylesheets/all.css.scss", File.join(location, "source", options[:css_dir], "all.css.scss")
copy_file "default/source/stylesheets/_animate.scss", File.join(location, "source", options[:css_dir], "_animate.scss")
copy_file "default/source/stylesheets/_normalize.scss", File.join(location, "source", options[:css_dir], "_normalize.scss")
empty_directory File.join(location, "source", options[:js_dir])
copy_file "default/source/javascripts/all.js", File.join(location, "source", options[:js_dir], "all.js")
empty_directory File.join(location, "source", options[:images_dir])
copy_file "default/source/images/background.png", File.join(location, "source", options[:images_dir], "background.png")
copy_file "default/source/images/middleman.png", File.join(location, "source", options[:images_dir], "middleman.png")
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

13
lib/middleman/templates/default/source/index.html.erb Executable file → Normal file
View file

@ -1,5 +1,10 @@
<% content_for :head do %>
<title>The Middleman!</title>
<% end %>
---
title: Welcome to Middleman
---
<h1>The Middleman is watching.</h1>
<div class="welcome">
<h1>Middleman is Watching</h1>
<p class="doc">
<%= link_to "Read Online Documentation", "http://middlemanapp.com/" %>
</p><!-- .doc -->
</div><!-- .welcome -->

View file

@ -0,0 +1 @@
//= require_tree .

View file

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<%= stylesheet_link_tag "site.css" %>
<%= yield_content :head %>
</head>
<body class="<%= page_classes %>">
<div id="main" role="main">
<%= yield %>
</div>
</body>
</html>

View file

@ -0,0 +1,19 @@
<doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- Always force latest IE rendering engine or request Chrome Frame -->
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<!-- Use title if it's in the page YAML frontmatter -->
<title><%= data.page.title || "The Middleman" %></title>
<%= stylesheet_link_tag "all" %>
<%= javascript_include_tag "all" %>
</head>
<body class="<%= page_classes %>">
<%= yield %>
</body>
</html>

View file

@ -0,0 +1,23 @@
.welcome {
-webkit-animation-name: welcome;
-webkit-animation-duration: .9s;
}
@-webkit-keyframes welcome {
from {
-webkit-transform: scale(0);
opacity: 0;
}
50% {
-webkit-transform: scale(0);
opacity: 0;
}
82.5% {
-webkit-transform: scale(1.03);
-webkit-animation-timing-function: ease-out;
opacity: 1;
}
to {
-webkit-transform: scale(1);
}
}

View file

@ -0,0 +1,431 @@
/*! normalize.css 2011-11-04T15:38 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
HTML5 display definitions
========================================================================== */
/*
* Corrects block display not defined in IE6/7/8/9 & FF3
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
display: block;
}
/*
* Corrects inline-block display not defined in IE6/7/8/9 & FF3
*/
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
}
/*
* Prevents modern browsers from displaying 'audio' without controls
*/
audio:not([controls]) {
display: none;
}
/*
* Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4
* Known issue: no IE6 support
*/
[hidden] {
display: none;
}
/* =============================================================================
Base
========================================================================== */
/*
* 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units
* http://clagnut.com/blog/348/#c790
* 2. Keeps page centred in all browsers regardless of content height
* 3. Prevents iOS text size adjust after orientation change, without disabling user zoom
* www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/
*/
html {
font-size: 100%; /* 1 */
overflow-y: scroll; /* 2 */
-webkit-text-size-adjust: 100%; /* 3 */
-ms-text-size-adjust: 100%; /* 3 */
}
/*
* Addresses margins handled incorrectly in IE6/7
*/
body {
margin: 0;
}
/*
* Addresses font-family inconsistency between 'textarea' and other form elements.
*/
body,
button,
input,
select,
textarea {
font-family: sans-serif;
}
/* =============================================================================
Links
========================================================================== */
/*
* Addresses outline displayed oddly in Chrome
*/
a:focus {
outline: thin dotted;
}
/*
* Improves readability when focused and also mouse hovered in all browsers
* people.opera.com/patrickl/experiments/keyboard/test
*/
a:hover,
a:active {
outline: 0;
}
/* =============================================================================
Typography
========================================================================== */
/*
* Neutralise smaller font-size in 'section' and 'article' in FF4+, Chrome, S5
*/
h1 {
font-size: 2em;
}
/*
* Addresses styling not present in IE7/8/9, S5, Chrome
*/
abbr[title] {
border-bottom: 1px dotted;
}
/*
* Addresses style set to 'bolder' in FF3+, S4/5, Chrome
*/
b,
strong {
font-weight: bold;
}
blockquote {
margin: 1em 40px;
}
/*
* Addresses styling not present in S5, Chrome
*/
dfn {
font-style: italic;
}
/*
* Addresses styling not present in IE6/7/8/9
*/
mark {
background: #ff0;
color: #000;
}
/*
* Corrects font family set oddly in IE6, S4/5, Chrome
* en.wikipedia.org/wiki/User:Davidgothberg/Test59
*/
pre,
code,
kbd,
samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em;
}
/*
* Improves readability of pre-formatted text in all browsers
*/
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
/*
* 1. Addresses CSS quotes not supported in IE6/7
* 2. Addresses quote property not supported in S4
*/
/* 1 */
q {
quotes: none;
}
/* 2 */
q:before,
q:after {
content: '';
content: none;
}
small {
font-size: 75%;
}
/*
* Prevents sub and sup affecting line-height in all browsers
* gist.github.com/413930
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* =============================================================================
Lists
========================================================================== */
ul,
ol {
margin-left: 0;
padding: 0 0 0 40px;
}
dd {
margin: 0 0 0 40px;
}
nav ul,
nav ol {
list-style: none;
list-style-image: none;
}
/* =============================================================================
Embedded content
========================================================================== */
/*
* 1. Removes border when inside 'a' element in IE6/7/8/9, FF3
* 2. Improves image quality when scaled in IE7
* code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
*/
img {
border: 0; /* 1 */
-ms-interpolation-mode: bicubic; /* 2 */
}
/*
* Corrects overflow displayed oddly in IE9
*/
svg:not(:root) {
overflow: hidden;
}
/* =============================================================================
Figures
========================================================================== */
/*
* Addresses margin not present in IE6/7/8/9, S5, O11
*/
figure {
margin: 0;
}
/* =============================================================================
Forms
========================================================================== */
/*
* Corrects margin displayed oddly in IE6/7
*/
form {
margin: 0;
}
/*
* Define consistent border, margin, and padding
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/*
* 1. Corrects color not being inherited in IE6/7/8/9
* 2. Corrects alignment displayed oddly in IE6/7
*/
legend {
border: 0; /* 1 */
*margin-left: -7px; /* 2 */
}
/*
* 1. Corrects font size not being inherited in all browsers
* 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome
* 3. Improves appearance and consistency in all browsers
*/
button,
input,
select,
textarea {
font-size: 100%; /* 1 */
margin: 0; /* 2 */
vertical-align: baseline; /* 3 */
*vertical-align: middle; /* 3 */
}
/*
* Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet
*/
button,
input {
line-height: normal; /* 1 */
}
/*
* 1. Improves usability and consistency of cursor style between image-type 'input' and others
* 2. Corrects inability to style clickable 'input' types in iOS
* 3. Removes inner spacing in IE7 without affecting normal text inputs
* Known issue: inner spacing remains in IE6
*/
button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
cursor: pointer; /* 1 */
-webkit-appearance: button; /* 2 */
*overflow: visible; /* 3 */
}
/*
* 1. Addresses box sizing set to content-box in IE8/9
* 2. Removes excess padding in IE8/9
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/*
* 1. Addresses appearance set to searchfield in S5, Chrome
* 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/*
* Removes inner padding that is displayed in S5, Chrome on OS X
*/
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/*
* Removes inner padding and border in FF3+
* www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/*
* 1. Removes default vertical scrollbar in IE6/7/8/9
* 2. Improves readability and alignment in all browsers
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* =============================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells
*/
table {
border-collapse: collapse;
border-spacing: 0;
}

View file

@ -0,0 +1,40 @@
@charset "utf-8";
@import "normalize";
@import "compass";
body {
background: #d4d4d4 image-url("background.png");
text-align: center;
font-family: sans-serif;
}
h1 {
color: rgba(black, .3);
font-weight: bold;
@include adjust-font-size-to(32px);
letter-spacing: -1px;
text-transform: uppercase;
text-shadow: 0 1px 0 rgba(white, .5);
background: image-url("middleman.png") no-repeat center 100px;
padding: 350px 0 10px;
margin: 0;
}
.doc {
@include adjust-font-size-to(14px);
margin: 0;
&:before,
&:after {
opacity: .2;
padding: 6px;
font-style: normal;
position: relative;
content: "";
}
a {
@include link-colors( rgba( black, .3 ) , #666);
}
}
@import "animate";

View file

@ -1,32 +0,0 @@
@import "compass";
$link-color: #0388a6;
$link-hover-color: #009ce0;
$link-focus-color: false;
$link-active-color: false;
$link-visited-color: false;
$font-color: #2a2a2a;
$font-family: sans-serif;
$base-font-size: 12px;
$base-line-height: 18px;
$total-cols: 12;
$col-width: 4em;
$gutter-width: 1em;
$side-gutter-width: $gutter-width;
@include global-reset;
body {
font-family: $font-family;
color: $font-color;
}
a {
@include link-colors($link-color, $link-hover-color, $link-focus-color, $link-active-color, $link-visited-color);
}
#main {
padding: 50px;
}

View file

@ -12,22 +12,7 @@
# end
###
# Haml
###
# CodeRay syntax highlighting in Haml
# First: gem install haml-coderay
# require 'haml-coderay'
# CoffeeScript filters in Haml
# First: gem install coffee-filter
# require 'coffee-filter'
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
###
# Page command
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
@ -52,6 +37,9 @@
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper