From 145f81046bc5881d7da86b05c8b92862b63f8080 Mon Sep 17 00:00:00 2001 From: B Mathis Date: Thu, 5 Nov 2009 21:30:03 -0600 Subject: [PATCH] updated rake file, reorganized stylesheets, added google site search, added google analytics --- Rakefile | 50 ++++++++++---- config.rb | 2 +- source/_layouts/default.haml | 24 +++++-- source/images/search_bg.png | Bin 0 -> 1058 bytes source/stylesheets/_base.sass | 3 + .../{partials/main => }/_layout.sass | 2 + source/stylesheets/_partials.sass | 2 + .../{partials/main => }/_theme.sass | 0 .../{partials/base => }/_typography.sass | 0 source/stylesheets/partials/_base.sass | 16 ----- source/stylesheets/partials/_main.sass | 4 -- source/stylesheets/partials/_search.sass | 18 ++++++ .../partials/{main => }/_twitter.sass | 0 .../partials/main/_flash_messages.sass | 36 ----------- source/stylesheets/partials/main/_form.sass | 61 ------------------ source/stylesheets/screen.sass | 12 +++- 16 files changed, 92 insertions(+), 138 deletions(-) create mode 100644 source/images/search_bg.png create mode 100644 source/stylesheets/_base.sass rename source/stylesheets/{partials/main => }/_layout.sass (98%) create mode 100644 source/stylesheets/_partials.sass rename source/stylesheets/{partials/main => }/_theme.sass (100%) rename source/stylesheets/{partials/base => }/_typography.sass (100%) delete mode 100644 source/stylesheets/partials/_base.sass delete mode 100644 source/stylesheets/partials/_main.sass create mode 100644 source/stylesheets/partials/_search.sass rename source/stylesheets/partials/{main => }/_twitter.sass (100%) delete mode 100644 source/stylesheets/partials/main/_flash_messages.sass delete mode 100644 source/stylesheets/partials/main/_form.sass diff --git a/Rakefile b/Rakefile index 08b2918..690c31b 100644 --- a/Rakefile +++ b/Rakefile @@ -18,8 +18,13 @@ def ok_failed(condition) end end +desc "generate website in output directory" +task :default => [:generate_site, :generate_style] do + puts "--Site Generating Complete!--" +end + desc "list tasks" -task :default do +task :list do puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:default]]).to_sentence}" puts "(type rake -T for more detail)\n\n" end @@ -35,18 +40,29 @@ task :clean_debug do Dir["#{site}/debug"].each { |f| rm_rf(f) } end -desc "generate website in output directory" -task :generate => :clean do +desc "Generate styles only" +task :generate_style do + puts "Generating website..." + system "compass" +end + +desc "Generate site files only" +task :generate_site => :clean do puts "Generating website..." system "jekyll" Dir["#{site}/stylesheets/*.sass"].each { |f| rm_rf(f) } - system "compass" system "mv #{site}/atom.html #{site}/atom.xml" end def rebuild_site(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 <<<' end @@ -54,15 +70,25 @@ desc "Watch the site and regenerate when it changes" task :watch do require 'fssm' puts ">>> Watching for Changes <<<" - FSSM.monitor("#{File.dirname(__FILE__)}/#{source}", '**/*') do - update {|base, relative| rebuild_site(relative)} - delete {|base, relative| rebuild_site(relative)} - create {|base, relative| rebuild_site(relative)} + FSSM.monitor do + path "#{File.dirname(__FILE__)}/#{source}" do + update {|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 + FSSM.monitor("#{File.dirname(__FILE__)}/#{source}/stylesheets", '**/*') do + end desc "generate and deploy website" -multitask :deploy => [:generate, :clean_debug] do +multitask :deploy => [:default, :clean_debug] do print "Deploying website..." ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}") end @@ -87,13 +113,13 @@ task :stop_serve do end 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}" end 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| if f.ends_with?("index.html") f[0..(-("index.html".size + 1))] diff --git a/config.rb b/config.rb index 1d7be82..aaf0042 100644 --- a/config.rb +++ b/config.rb @@ -4,7 +4,7 @@ project_type = :stand_alone # Set this to the root of your project when deployed: http_path = "/" css_dir = "site/stylesheets" -sass_dir = "source/stylesheets" +sass_dir = "/stylesheets" images_dir = "images" # To enable relative paths to assets via compass helper functions. Uncomment: diff --git a/source/_layouts/default.haml b/source/_layouts/default.haml index 481791c..30f4da1 100644 --- a/source/_layouts/default.haml +++ b/source/_layouts/default.haml @@ -1,6 +1,6 @@ --- blog_title: My Octopress Blog -root_url: +google_site_search_id: --- !!! 1.1 Transitional @@ -13,24 +13,29 @@ root_url: %meta(name="keywords" content="#{page.keywords}")/ %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") - /%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/jsonp.js" type="text/javascript") %script(src="/javascripts/twitter_gitter.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 #header .page_width %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 .page_width %ul %li.alpha - %a(href="#{page.root_url}/") Blog + %a(href="/") Blog %li.omega - %a(href="#{page.root_url}/about") About + %a(href="/about") About %li.subscribe - %a(href="#{page.root_url}/atom.xml") Subscribe + %a(href="/atom.xml") Subscribe #page .page_width #main @@ -49,4 +54,11 @@ root_url: #footer .page_width = "Copyright © #{Time.now.strftime('%Y')} - #{page.blog_title} | " - %span.credit Powered by Octopress \ No newline at end of file + %span.credit Powered by Octopress + + //Google Analytics code + :javascript + try { + var pageTracker = _gat._getTracker("UA-10876422-1"); + pageTracker._trackPageview(); + } catch(err) {} \ No newline at end of file diff --git a/source/images/search_bg.png b/source/images/search_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..0587723eeab9f48b902c76928cd1283923e2b309 GIT binary patch literal 1058 zcmV+-1l{|IP)5dG9n4|}!4%pCb?Bgw4q``(;3PDI;2>y35GS=DxCpv9IMvNAO0>|T2o-;a;!i4V zRg8_6q-sp;JJ%?Q(d1Q^=H+~FczU^c!y%vNoSXPK5P?i4%MmV)NR$a-27*X^wuD#^ zVjLqJ4j(3a0hdG+lW=hf(LlK+(tr_szYF4cZrdPFAWKKYyfVroktX1K-N|troS&ah zi>fe@_6tR^Q~roF#*HJ$^)`*WK^8Yv6@p;kd}EK6=DILnNEU*Kl|~TeN!$z*nOR;_ zeh4B4L-b6;DvVq%$J4Ma$_+u>ia8Vtd3a_G$GOD3A}cEknwpxxX0t(db~amETwH|F z(NS1hTB4K^QU)D)!zzqIq4*_SG|6P?>FEKB#lj>(K~S2isw#Hv?d^rh$w^8pAys_A zU@(_cDwQwb;$$o#PNx&9tE-`}uP;UnyPhQ`~8$!LaNw#p&he}*;!Fh z!K%vC)D*UGSL=IwdoVOK1Z{0?tW~2bLr7g1Q9H5iT3%j;oA%Gn&R$g;vG*g0RD_qw zWTH2tG&k+f&(DX*;Q{>1{RkrEgb`a2u=T2}tc0<#vA8* z8MbBv0|Vf8yD77T9@=$R&Xdg3}b*wq{z9Z(ht$)i?lL95mK6v_R literal 0 HcmV?d00001 diff --git a/source/stylesheets/_base.sass b/source/stylesheets/_base.sass new file mode 100644 index 0000000..82b34b7 --- /dev/null +++ b/source/stylesheets/_base.sass @@ -0,0 +1,3 @@ +//compass default reset ++global-reset +@import compass/utilities.sass \ No newline at end of file diff --git a/source/stylesheets/partials/main/_layout.sass b/source/stylesheets/_layout.sass similarity index 98% rename from source/stylesheets/partials/main/_layout.sass rename to source/stylesheets/_layout.sass index 0275a51..ab06b65 100644 --- a/source/stylesheets/partials/main/_layout.sass +++ b/source/stylesheets/_layout.sass @@ -18,6 +18,8 @@ html body background-color= !header_bg border-bottom= "1px solid" !header_border padding: 30px 0 + .page_width + position: relative a.title font-size= !h1 +heading-font diff --git a/source/stylesheets/_partials.sass b/source/stylesheets/_partials.sass new file mode 100644 index 0000000..326df48 --- /dev/null +++ b/source/stylesheets/_partials.sass @@ -0,0 +1,2 @@ +@import partials/twitter.sass +@import partials/search.sass \ No newline at end of file diff --git a/source/stylesheets/partials/main/_theme.sass b/source/stylesheets/_theme.sass similarity index 100% rename from source/stylesheets/partials/main/_theme.sass rename to source/stylesheets/_theme.sass diff --git a/source/stylesheets/partials/base/_typography.sass b/source/stylesheets/_typography.sass similarity index 100% rename from source/stylesheets/partials/base/_typography.sass rename to source/stylesheets/_typography.sass diff --git a/source/stylesheets/partials/_base.sass b/source/stylesheets/partials/_base.sass deleted file mode 100644 index c88d3c0..0000000 --- a/source/stylesheets/partials/_base.sass +++ /dev/null @@ -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 \ No newline at end of file diff --git a/source/stylesheets/partials/_main.sass b/source/stylesheets/partials/_main.sass deleted file mode 100644 index 374268c..0000000 --- a/source/stylesheets/partials/_main.sass +++ /dev/null @@ -1,4 +0,0 @@ -@import main/theme.sass -@import main/layout.sass -@import main/form.sass -@import main/twitter.sass \ No newline at end of file diff --git a/source/stylesheets/partials/_search.sass b/source/stylesheets/partials/_search.sass new file mode 100644 index 0000000..4de9c02 --- /dev/null +++ b/source/stylesheets/partials/_search.sass @@ -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 \ No newline at end of file diff --git a/source/stylesheets/partials/main/_twitter.sass b/source/stylesheets/partials/_twitter.sass similarity index 100% rename from source/stylesheets/partials/main/_twitter.sass rename to source/stylesheets/partials/_twitter.sass diff --git a/source/stylesheets/partials/main/_flash_messages.sass b/source/stylesheets/partials/main/_flash_messages.sass deleted file mode 100644 index bdc9f9c..0000000 --- a/source/stylesheets/partials/main/_flash_messages.sass +++ /dev/null @@ -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 \ No newline at end of file diff --git a/source/stylesheets/partials/main/_form.sass b/source/stylesheets/partials/main/_form.sass deleted file mode 100644 index dc28ff0..0000000 --- a/source/stylesheets/partials/main/_form.sass +++ /dev/null @@ -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 \ No newline at end of file diff --git a/source/stylesheets/screen.sass b/source/stylesheets/screen.sass index 51e46f6..e7fcb53 100644 --- a/source/stylesheets/screen.sass +++ b/source/stylesheets/screen.sass @@ -1,3 +1,11 @@ +/* SASS mixins */ @import library.sass -@import partials/base.sass -@import partials/main.sass \ No newline at end of file + +/* primary SASS */ +@import base.sass +@import theme.sass +@import typography.sass +@import layout.sass + +/* specific SASS */ +@import partials.sass \ No newline at end of file