updated rake file, reorganized stylesheets, added google site search, added google analytics

This commit is contained in:
B Mathis 2009-11-05 21:30:03 -06:00
parent fc691c1da6
commit 145f81046b
16 changed files with 92 additions and 138 deletions

View File

@ -18,8 +18,13 @@ def ok_failed(condition)
end end
end end
desc "generate website in output directory"
task :default => [:generate_site, :generate_style] do
puts "--Site Generating Complete!--"
end
desc "list tasks" desc "list tasks"
task :default do task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:default]]).to_sentence}" puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:default]]).to_sentence}"
puts "(type rake -T for more detail)\n\n" puts "(type rake -T for more detail)\n\n"
end end
@ -35,18 +40,29 @@ task :clean_debug do
Dir["#{site}/debug"].each { |f| rm_rf(f) } Dir["#{site}/debug"].each { |f| rm_rf(f) }
end end
desc "generate website in output directory" desc "Generate styles only"
task :generate => :clean do task :generate_style do
puts "Generating website..."
system "compass"
end
desc "Generate site files only"
task :generate_site => :clean do
puts "Generating website..." puts "Generating website..."
system "jekyll" system "jekyll"
Dir["#{site}/stylesheets/*.sass"].each { |f| rm_rf(f) } Dir["#{site}/stylesheets/*.sass"].each { |f| rm_rf(f) }
system "compass"
system "mv #{site}/atom.html #{site}/atom.xml" system "mv #{site}/atom.html #{site}/atom.xml"
end end
def rebuild_site(relative) def rebuild_site(relative)
puts ">>> Change Detected to: #{relative} <<<" puts ">>> Change Detected to: #{relative} <<<"
IO.popen('rake generate'){|io| print(io.readpartial(512)) until io.eof?} IO.popen('rake generate_site'){|io| print(io.readpartial(512)) until io.eof?}
puts '>>> Update Complete <<<'
end
def rebuild_style(relative)
puts ">>> Change Detected to: #{relative} <<<"
IO.popen('rake generate_style'){|io| print(io.readpartial(512)) until io.eof?}
puts '>>> Update Complete <<<' puts '>>> Update Complete <<<'
end end
@ -54,15 +70,25 @@ desc "Watch the site and regenerate when it changes"
task :watch do task :watch do
require 'fssm' require 'fssm'
puts ">>> Watching for Changes <<<" puts ">>> Watching for Changes <<<"
FSSM.monitor("#{File.dirname(__FILE__)}/#{source}", '**/*') do FSSM.monitor do
update {|base, relative| rebuild_site(relative)} path "#{File.dirname(__FILE__)}/#{source}" do
delete {|base, relative| rebuild_site(relative)} update {|base, relative| rebuild_site(relative)}
create {|base, relative| rebuild_site(relative)} delete {|base, relative| rebuild_site(relative)}
create {|base, relative| rebuild_site(relative)}
end
path "#{File.dirname(__FILE__)}/#{source}/stylesheets" do
glob '**/*.sass'
update {|base, relative| rebuild_style(relative)}
delete {|base, relative| rebuild_style(relative)}
create {|base, relative| rebuild_style(relative)}
end
end end
FSSM.monitor("#{File.dirname(__FILE__)}/#{source}/stylesheets", '**/*') do
end end
desc "generate and deploy website" desc "generate and deploy website"
multitask :deploy => [:generate, :clean_debug] do multitask :deploy => [:default, :clean_debug] do
print "Deploying website..." print "Deploying website..."
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}") ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
end end
@ -87,13 +113,13 @@ task :stop_serve do
end end
desc "preview the site in a web browser" desc "preview the site in a web browser"
multitask :preview => [:generate, :start_serve] do multitask :preview => [:default, :start_serve] do
system "open http://localhost:#{port}" system "open http://localhost:#{port}"
end end
desc "Build an XML sitemap of all html files." desc "Build an XML sitemap of all html files."
task :sitemap => :generate do task :sitemap => :default do
html_files = FileList.new("#{site}/**/*.html").map{|f| f[("#{site}".size)..-1]}.map do |f| html_files = FileList.new("#{site}/**/*.html").map{|f| f[("#{site}".size)..-1]}.map do |f|
if f.ends_with?("index.html") if f.ends_with?("index.html")
f[0..(-("index.html".size + 1))] f[0..(-("index.html".size + 1))]

View File

@ -4,7 +4,7 @@ project_type = :stand_alone
# Set this to the root of your project when deployed: # Set this to the root of your project when deployed:
http_path = "/" http_path = "/"
css_dir = "site/stylesheets" css_dir = "site/stylesheets"
sass_dir = "source/stylesheets" sass_dir = "/stylesheets"
images_dir = "images" images_dir = "images"
# To enable relative paths to assets via compass helper functions. Uncomment: # To enable relative paths to assets via compass helper functions. Uncomment:

View File

@ -1,6 +1,6 @@
--- ---
blog_title: My Octopress Blog blog_title: My Octopress Blog
root_url: google_site_search_id:
--- ---
!!! 1.1 Transitional !!! 1.1 Transitional
@ -13,24 +13,29 @@ root_url:
%meta(name="keywords" content="#{page.keywords}")/ %meta(name="keywords" content="#{page.keywords}")/
%link(href="/stylesheets/screen.css" rel="stylesheet" media="screen projection" type="text/css") %link(href="/stylesheets/screen.css" rel="stylesheet" media="screen projection" type="text/css")
%link(href="/atom.xml" rel="alternate" title="#{page.blog_title}" type="application/atom+xml") %link(href="/atom.xml" rel="alternate" title="#{page.blog_title}" type="application/atom+xml")
/%script(src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools-yui-compressed.js" type="text/javascript")/
%script(src="/javascripts/mootools-yui-compressed.js" type="text/javascript") %script(src="/javascripts/mootools-yui-compressed.js" type="text/javascript")
%script(src="/javascripts/jsonp.js" type="text/javascript") %script(src="/javascripts/jsonp.js" type="text/javascript")
%script(src="/javascripts/twitter_gitter.js" type="text/javascript") %script(src="/javascripts/twitter_gitter.js" type="text/javascript")
%script(src="/javascripts/twitter.js" type="text/javascript") %script(src="/javascripts/twitter.js" type="text/javascript")
%script(src="http://www.google-analytics.com/ga.js" type="text/javascript")
%body %body
#header #header
.page_width .page_width
%a.title(href="/")=page.blog_title %a.title(href="/")=page.blog_title
#search
%form(action="http://www.google.com/cse" id="cse-search-box")
%input(type="hidden" name="cx" value="#{page.google_site_search_id}")
%input(type="hidden" name="ie" value="UTF-8")
%input#q(type="text" name="q")
#nav #nav
.page_width .page_width
%ul %ul
%li.alpha %li.alpha
%a(href="#{page.root_url}/") Blog %a(href="/") Blog
%li.omega %li.omega
%a(href="#{page.root_url}/about") About %a(href="/about") About
%li.subscribe %li.subscribe
%a(href="#{page.root_url}/atom.xml") Subscribe %a(href="/atom.xml") Subscribe
#page #page
.page_width .page_width
#main #main
@ -50,3 +55,10 @@ root_url:
.page_width .page_width
= "Copyright &copy; #{Time.now.strftime('%Y')} - #{page.blog_title} | " = "Copyright &copy; #{Time.now.strftime('%Y')} - #{page.blog_title} | "
%span.credit Powered by <a href="http://github.com/imathis/octopress/">Octopress</a> %span.credit Powered by <a href="http://github.com/imathis/octopress/">Octopress</a>
//Google Analytics code
:javascript
try {
var pageTracker = _gat._getTracker("UA-10876422-1");
pageTracker._trackPageview();
} catch(err) {}

BIN
source/images/search_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,3 @@
//compass default reset
+global-reset
@import compass/utilities.sass

View File

@ -18,6 +18,8 @@ html body
background-color= !header_bg background-color= !header_bg
border-bottom= "1px solid" !header_border border-bottom= "1px solid" !header_border
padding: 30px 0 padding: 30px 0
.page_width
position: relative
a.title a.title
font-size= !h1 font-size= !h1
+heading-font +heading-font

View File

@ -0,0 +1,2 @@
@import partials/twitter.sass
@import partials/search.sass

View File

@ -1,16 +0,0 @@
//compass default reset
+global-reset
//my reset
button
margin: 0
padding: 0
background: none
border: none
cursor: pointer
button::-moz-focus-inner
border: none
padding: 0
@import compass/utilities.sass
@import base/typography.sass

View File

@ -1,4 +0,0 @@
@import main/theme.sass
@import main/layout.sass
@import main/form.sass
@import main/twitter.sass

View File

@ -0,0 +1,18 @@
#search
position: absolute
left= !page_width + !sidebar_margin - !sidebar_width
top= 10%
form
background: url(/images/search_bg.png) no-repeat
padding: 2px 0 0
height: 28px
width: 218px
#q
background: none
width: 160px
margin-left: 30px
font-size: 15px
border: none
color: #aaa
&:focus
outline: none

View File

@ -1,36 +0,0 @@
!flash_notice ||= #00529B
!flash_success ||= #4F8A10
!flash_warning ||= #FBF4BD
!flash_error ||= #D8000C
!flash_notice_bg ||= #BDE5F8
!flash_success_bg ||= #DFF2BF
!flash_warning_bg ||= #FBF4BD
!flash_error_bg ||= #FFD9DA
=flash-message-style
+flash-message-structure
&.notice
+flash-color(!flash_notice, !flash_notice_bg)
&.success
+flash-color(!flash_success, !flash_success_bg)
&.warning
+flash-color(!flash_warning, !flash_warning_bg)
&.error
+flash-color(!flash_error, !flash_error_bg)
=flash-message-structure
background-repeat: no-repeat
background-position: 10px center
border: 1px dashed
padding: 10px 15px
margin: 0 0 15px
=flash-color(!color, !bg = 0)
color= !color
@if !bg == 0
background-color= desaturate(lighten(adjust_hue(!color, -10), 83), 20)
@else
background-color= !bg
#flash
+flash-message-style

View File

@ -1,61 +0,0 @@
#page
form
clear: both
padding-bottom= !pad
fieldset, fieldset input.textbox, fieldset textarea
+border-radius
fieldset
background-color= !fieldset_bg
width: 480px
border= "1px solid" !fieldset_border
padding: 35px 25px 20px
margin-bottom= !pad*2.2
label
font-size: 90%
display: block
padding-bottom: 4px
select
font-size: 110%
input.textbox, textarea
font-size: 115%
color= !textinput_color
background-color= !textinput_bg
width: 70%
padding: 6px 8px
outline: 0
display: inline-block
border: 1px solid
border-top-color= !textinput_border_top
border-bottom-color= !textinput_border_bottom
border-left-color= !textinput_border_left
border-right-color= !textinput_border_right
&:focus
background= !textinput_bg_focus
border-color= !textinput_border_focus
input.checkbox, label.checkbox
display: inline-block
p
+clearfix
padding= 0 8px !pad
input.wrong:focus
outline: 2px solid #d0a5a5
background: #fef2f2
button
+border-radius(5px)
+btn-style(!blue_btn)
+btn-structure(18px, 1px)
color= !default_button_text_color
border:
width: 1px
style: solid
&:hover, &:focus
+btn-style-hover(!blue_btn)
outline: none
&:active
+btn-style-active(!blue_btn)
a.cancel
color= !cancel_link

View File

@ -1,3 +1,11 @@
/* SASS mixins */
@import library.sass @import library.sass
@import partials/base.sass
@import partials/main.sass /* primary SASS */
@import base.sass
@import theme.sass
@import typography.sass
@import layout.sass
/* specific SASS */
@import partials.sass