Skip to content

Commit

Permalink
Create basic Middleman project
Browse files Browse the repository at this point in the history
  • Loading branch information
dis-aster-ous committed Dec 11, 2015
1 parent d6cd132 commit 0989b43
Show file tree
Hide file tree
Showing 10 changed files with 745 additions and 29 deletions.
49 changes: 20 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/db/*.sqlite3-journal
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global

# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/secrets.yml

## Environment normalisation:
# Ignore bundler config
/.bundle
/vendor/bundle

# these should all be checked in to normalise the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset
# Ignore the build directory
/build

# Ignore Sass' cache
/.sass-cache

# Ignore all caches
/.cache

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# Ignore .DS_store file
.DS_Store

# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json
# Ignore bower components
bower_components

# Ignore pow environment settings
.powenv
# Ignore dotenv files
.env
16 changes: 16 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# If you have OpenSSL installed, we recommend updating
# the following line to use "https"
source "https://rubygems.org"
ruby "2.2.3"

gem "middleman", "~> 3.3.7"
gem "middleman-deploy", "~> 1.0"
gem "bourbon", "~>4.0.2"

gem "middleman-livereload"

gem "oj" # faster JS compiles
gem "therubyracer" # faster JS compiles
gem "middleman-minify-html", "~>3.4.1"
gem "middleman-dotenv", "~> 1.0"

161 changes: 161 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.1.14)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
bourbon (4.0.2)
sass (~> 3.3)
thor
celluloid (0.16.0)
timers (~> 4.0.0)
chunky_png (1.3.5)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
compass-import-once (~> 1.0.5)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
sass (>= 3.3.13, < 3.5)
compass-core (1.0.3)
multi_json (~> 1.0)
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
dotenv (1.0.2)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.0.8)
execjs (2.6.0)
ffi (1.9.10)
haml (4.0.7)
tilt
hike (1.2.3)
hitimes (1.2.3)
hooks (0.4.1)
uber (~> 0.0.14)
htmlcompressor (0.2.0)
http_parser.rb (0.6.0)
i18n (0.7.0)
json (1.8.3)
kramdown (1.9.0)
libv8 (3.16.14.13)
listen (2.10.1)
celluloid (~> 0.16.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
middleman (3.3.12)
coffee-script (~> 2.2)
compass (>= 1.0.0, < 2.0.0)
compass-import-once (= 1.0.5)
execjs (~> 2.0)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-core (= 3.3.12)
middleman-sprockets (>= 3.1.2)
sass (>= 3.4.0, < 4.0)
uglifier (~> 2.5)
middleman-core (3.3.12)
activesupport (~> 4.1.0)
bundler (~> 1.1)
erubis
hooks (~> 0.3)
i18n (~> 0.7.0)
listen (>= 2.7.9, < 3.0)
padrino-helpers (~> 0.12.3)
rack (>= 1.4.5, < 2.0)
rack-test (~> 0.6.2)
thor (>= 0.15.2, < 2.0)
tilt (~> 1.4.1, < 2.0)
middleman-deploy (1.0.0)
middleman-core (>= 3.2)
net-sftp
ptools
middleman-dotenv (1.1.1)
dotenv (~> 1.0)
middleman-core (>= 3.2)
middleman-livereload (3.1.1)
em-websocket (>= 0.2.0)
middleman-core (>= 3.0.2)
multi_json (~> 1.0)
rack-livereload
middleman-minify-html (3.4.1)
htmlcompressor (~> 0.2.0)
middleman-core (>= 3.2)
middleman-sprockets (3.4.2)
middleman-core (>= 3.3)
sprockets (~> 2.12.1)
sprockets-helpers (~> 1.1.0)
sprockets-sass (~> 1.3.0)
minitest (5.8.3)
multi_json (1.11.2)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (3.0.1)
oj (2.13.1)
padrino-helpers (0.12.5)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.12.5)
tilt (~> 1.4.1)
padrino-support (0.12.5)
activesupport (>= 3.1)
ptools (1.3.3)
rack (1.6.4)
rack-livereload (0.3.16)
rack
rack-test (0.6.3)
rack (>= 1.0)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
ref (2.0.0)
sass (3.4.19)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-helpers (1.1.0)
sprockets (~> 2.0)
sprockets-sass (1.3.1)
sprockets (~> 2.0)
tilt (~> 1.1)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
timers (4.0.4)
hitimes
tzinfo (1.2.2)
thread_safe (~> 0.1)
uber (0.0.15)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)

PLATFORMS
ruby

DEPENDENCIES
bourbon (~> 4.0.2)
middleman (~> 3.3.7)
middleman-deploy (~> 1.0)
middleman-dotenv (~> 1.0)
middleman-livereload
middleman-minify-html (~> 3.4.1)
oj
therubyracer

BUNDLED WITH
1.10.6
14 changes: 14 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace :deploy do
def deploy(env)
puts "Deploying to #{env}"
system "TARGET=#{env} bundle exec middleman deploy"
end

task :staging do
deploy :staging
end

task :production do
deploy :production
end
end
23 changes: 23 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Middleboy Boilerplate",
"version": "1.0.0",
"homepage": "https://github.com/crtvhd/middleboy",
"authors": [
"Martin Wessely <martin@wesse.ly>"
],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": ">=1.11.1",
"svgeezy": "~1.0.0",
"bootstrap-sass-official": "~3.3.1",
"respond": "~1.4.2"
}
}
103 changes: 103 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
require "uglifier"

# Minimum Sass number precision required by bootstrap-sass
::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max

# Add Bower to sprockets
after_configuration do
sprockets.append_path File.join root.to_s, "bower_components"
end

# Integrate Dotenv
activate :dotenv

# Activate directory indexes for pretty urls
activate :directory_indexes

# Activate gzip compression
activate :gzip

# Set url root
set :url_root, build? ? ENV["URL_PRODUCTION"] : ENV["URL_DEVELOPMENT"]

# Asset paths
set :css_dir, "stylesheets"
set :js_dir, "javascripts"
set :images_dir, "images"

# Prevent asset concatenation in development
set :debug_assets, true

# Define 404 page
page "/404.html", :directory_index => false

# Reload the browser in development automatically whenever files change
configure :development do
activate :livereload
end

# Deployment via middleman-deploy.
# Usage:
# $ rake deploy
activate :deploy do |deploy|
deploy.build_before = true
deploy.method = :git
end

# Build-specific configuration
configure :build do

# For example, change the Compass output style for deployment
activate :minify_css, inline: true

# Minify Javascript
activate :minify_javascript, inline: true, compressor: Uglifier.new(mangle: false, comments: :none)

# Minify HTML
activate :minify_html, remove_comments: false

# Enable cache buster
activate :asset_hash

# Use relative URLs
activate :relative_assets
end

helpers do
# A simple helper to move partials to their own directory. There's probably a
# better way to do this, but ah well.
def partial(template, options = {})
render_partial "partials/#{template}", options
end

# Helper which generates <html> tag with conditional IE classes
# https://gist.github.com/SteveBenner/a71f41e175f135b7d69b
def conditional_html_tags(ie_versions, attributes={})
# Create an array from given range that allows us to generate the code via simple iteration
ie_versions = ie_versions.to_a.unshift(ie_versions.min - 1).push(ie_versions.max + 1)
# Classes from user-provided String or Array are appended after the default ones
extra_classes = attributes.delete(:class) { |key| attributes[key.to_s] }

commented_html_tags = ie_versions.collect { |version|
# A 'lt-ie' class is added for each supported IE version higher than the current one
ie_classes = (version+1..ie_versions.max).to_a.reverse.collect { |j| "lt-ie#{j}" }
class_str = ie_classes.unshift('no-js').push(extra_classes).compact.join ' '
attr_str = attributes.collect { |name, value| %Q[#{name.to_s}="#{value}"] }.join ' '
html_tag = %Q[<html class="#{class_str}"#{' ' unless attr_str.empty?}#{attr_str}>]
# The first and last IE conditional comments are unique
version_str = case version
when ie_versions.min then
"lt IE #{version + 1}"
# Side effects in a `case` statement are rarely a good idea, but it makes sense here
when ie_versions.max
# This is rather crucial; the last HTML tag must be uncommented in order to be recognized
html_tag.prepend('<!-->').concat('<!--') # Note that both methods are destructive
"gt IE #{version - 1}"
else "IE #{version}"
end
%Q[<!--[if #{version_str}]#{html_tag}<![endif]-->]
}.flatten * $/
# Return the output from given Slim blockm, wrapped in the code for commented HTML tags
[commented_html_tags, yield, $/, '</html>'].join
end
end
Loading

0 comments on commit 0989b43

Please sign in to comment.