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

View file

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

5
Rules
View file

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

View file

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

View file

@ -2,7 +2,9 @@
<div class="columns">
<div class="logo-wrapper column is-narrow is-hidden-mobile">
<a id="logo-link" href="/">
<% 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="" />
</a>
</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 BlogHelper
include PreprocessHelper
include TimeHelper