automate christmas and minify stuff

This commit is contained in:
Lorin Werthen 2016-12-29 13:37:22 +01:00
parent 6a8b2c14be
commit ab78e16186
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
8 changed files with 47 additions and 14 deletions

11
Gemfile
View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'nanoc', '4.4.3' gem 'nanoc', '4.4.6'
gem 'kramdown' gem 'kramdown'
gem 'coffee-script' gem 'coffee-script'
gem 'sass' gem 'sass'
@ -13,9 +13,6 @@ gem 'icalendar'
gem 'therubyracer' gem 'therubyracer'
# Autoprefixing for class
gem 'autoprefixer-rails'
# Word counting gem (which takes special characters into account) # Word counting gem (which takes special characters into account)
# for reading time # for reading time
gem 'words_counted' gem 'words_counted'
@ -26,6 +23,12 @@ group :development do
gem 'terminal-notifier-guard' gem 'terminal-notifier-guard'
end end
group :production do
# Autoprefixing for class
gem 'autoprefixer-rails'
gem 'html_press'
end
group :nanoc do group :nanoc do
gem 'guard-nanoc' gem 'guard-nanoc'
end end

View file

@ -12,9 +12,13 @@ GEM
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.10.0)
colored (1.2) colored (1.2)
concurrent-ruby (1.0.2) concurrent-ruby (1.0.4)
cri (2.7.1) cri (2.7.1)
colored (~> 1.2) colored (~> 1.2)
css_press (0.3.2)
csspool-st (= 3.1.2)
json
csspool-st (3.1.2)
execjs (2.7.0) execjs (2.7.0)
ffi (1.9.14) ffi (1.9.14)
formatador (0.2.5) formatador (0.2.5)
@ -35,6 +39,11 @@ GEM
hamster (3.0.0) hamster (3.0.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
highline (1.7.8) highline (1.7.8)
html_press (0.8.2)
htmlentities
multi_css (>= 0.1.0)
multi_js (>= 0.1.0)
htmlentities (4.3.4)
icalendar (2.4.1) icalendar (2.4.1)
json (2.0.2) json (2.0.2)
kramdown (1.13.0) kramdown (1.13.0)
@ -46,10 +55,13 @@ GEM
lumberjack (1.0.10) lumberjack (1.0.10)
method_source (0.8.2) method_source (0.8.2)
mini_portile2 (2.1.0) mini_portile2 (2.1.0)
nanoc (4.4.3) multi_css (0.1.0)
css_press
multi_js (0.1.0)
uglifier (~> 2)
nanoc (4.4.6)
cri (~> 2.3) cri (~> 2.3)
hamster (~> 3.0) hamster (~> 3.0)
parallel (~> 1.9)
ref (~> 2.0) ref (~> 2.0)
nenv (0.3.0) nenv (0.3.0)
nokogiri (1.6.8.1) nokogiri (1.6.8.1)
@ -57,7 +69,6 @@ GEM
notiffany (0.1.1) notiffany (0.1.1)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
parallel (1.10.0)
pry (0.10.4) pry (0.10.4)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
@ -76,6 +87,9 @@ GEM
libv8 (~> 3.16.14.0) libv8 (~> 3.16.14.0)
ref ref
thor (0.19.1) thor (0.19.1)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
w3c_validators (1.2) w3c_validators (1.2)
json json
nokogiri nokogiri
@ -91,9 +105,10 @@ DEPENDENCIES
coffee-script coffee-script
guard-nanoc guard-nanoc
highline highline
html_press
icalendar icalendar
kramdown kramdown
nanoc (= 4.4.3) nanoc (= 4.4.6)
sass sass
terminal-notifier-guard terminal-notifier-guard
therubyracer therubyracer

5
Rules
View file

@ -38,6 +38,7 @@ compile '/blog/*' do
layout '/generic.*' layout '/generic.*'
layout '/default.*' layout '/default.*'
filter :erb filter :erb
filter :html_press if production?
end end
# #
@ -49,6 +50,7 @@ compile '/events/**/*' do
layout '/eventpost.*' layout '/eventpost.*'
layout '/default.*' layout '/default.*'
filter :erb filter :erb
filter :html_press if production?
end end
compile '/events/**/*', rep: :text do compile '/events/**/*', rep: :text do
@ -70,6 +72,8 @@ compile '/blog/*/*' do
layout '/blogpost.erb' layout '/blogpost.erb'
layout '/generic.*' layout '/generic.*'
layout '/default.*' layout '/default.*'
filter :erb
filter :html_press if production?
end end
compile '/blog/*/*', rep: :text do compile '/blog/*/*', rep: :text do
@ -103,6 +107,7 @@ compile '/**/*.erb' do
layout '/generic.*' layout '/generic.*'
layout '/default.*' layout '/default.*'
filter :erb filter :erb
filter :html_press if production?
end end
# #

View file

@ -68,10 +68,7 @@
</div> </div>
<div class="columns"> <div class="columns">
<div class="google-maps column is-8 is-offset-2"> <div class="google-maps column is-8 is-offset-2">
<iframe <iframe frameborder="0" style="border:0" src="<%= locationlink item[:locationlink] %>" allowfullscreen> </iframe>
frameborder="0" style="border:0"
src="<%= locationlink item[:locationlink] %>" allowfullscreen>
</iframe>
</div> </div>
</div> </div>
</section> </section>

View file

@ -2,7 +2,9 @@
<div class="columns"> <div class="columns">
<div class="logo-wrapper column is-narrow is-hidden-mobile"> <div class="logo-wrapper column is-narrow is-hidden-mobile">
<a id="logo-link" href="/"> <a id="logo-link" href="/">
<img id="santa" src="https://upload.wikimedia.org/wikipedia/commons/c/c0/Santa_hat.svg"> <% if christmastime? %>
<img id="santa" src="https://upload.wikimedia.org/wikipedia/commons/c/c0/Santa_hat.svg">
<% end %>
<img id="logo" src="<%= zeus_logo_url color: @zeus_logo_color %>" alt="" /> <img id="logo" src="<%= zeus_logo_url color: @zeus_logo_color %>" alt="" />
</a> </a>
</div> </div>

5
lib/filters/htmlpress.rb Normal file
View file

@ -0,0 +1,5 @@
require 'html_press'
Nanoc::Filter.define(:html_press) do |content, _params|
HtmlPress.press content
end

5
lib/helpers/time.rb Normal file
View file

@ -0,0 +1,5 @@
module TimeHelper
def christmastime?
Time.now.month == 12
end
end

View file

@ -16,3 +16,4 @@ include ProjectsHelper
include SearchHelper include SearchHelper
include BlogHelper include BlogHelper
include PreprocessHelper include PreprocessHelper
include TimeHelper