Refactor theme handling so that it is unified via a helper method

This commit is contained in:
Ufuk Kayserilioglu committed 2015-03-16 21:43:31 +02:00
1 parent 2d62bd0147
commit 1ff838b5fe
4 files changed
+20 -12

No files matched your search

+12
View File
@@ -1,4 +1,5 @@
require 'lib/screenshot_generator'
require 'ostruct'
###
# Compass
###
@@ -91,3 +92,14 @@ activate :deploy do |deploy|
# deploy.strategy = :submodule # commit strategy: can be :force_push or :submodule, default: :force_push
# deploy.commit_message = 'custom-message' # commit message (can be empty), default: Automated commit at `timestamp` by middleman-deploy `version`
end
helpers do
def themes
data.themes.sort_by { |theme| theme[:name] }.map do |theme|
OpenStruct.new(theme.merge(
slug: theme[:name].parameterize.underscore,
digest: Digest::MD5.new.hexdigest(theme[:colors])
))
end
end
end