Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
First version of the @lewagon's Middleman Template
Browse files Browse the repository at this point in the history
  • Loading branch information
ssaunier committed Jul 25, 2017
0 parents commit ddea134
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.DS_Store
46 changes: 46 additions & 0 deletions README.md
@@ -0,0 +1,46 @@
# Le Wagon Middleman template

Welcome on this short guide on how to quickstart your next Middleman project with [Le Wagon](https://www.lewagon.com) best practices.

## Getting started

In your terminal, check you have Middleman:

```bash
gem install middleman
# You should have a version >= 4.2.1
```

Then run the following:

```bash
cd ~/code/YOUR_GITHUB_NICKNAME
middleman init YOUR_PROJECT -B -T lewagon/middleman-template
cd YOUR_PROJECT

git init
git add .
git commit -m 'Generated a new middleman project with lewagon/middleman-template'

hub create # To create a repo on GitHub
git remote -v # Check that the `origin` remote is set.
git push origin master
```

You should be able to run:

```bash
middleman server
```

And go to [localhost:4567](http://localhost:4567)

## Deployment

Make sure that your `git status` is clean and run:

```bash
middleman deploy
```

This should build your Middleman project and push it to the `gh-pages` of your GitHub repository. Then go to `YOUR_GITHUB_NICKNAME.github.io/YOUR_PROJECT` to see it live 🚀 !
29 changes: 29 additions & 0 deletions Thorfile
@@ -0,0 +1,29 @@
require 'thor/group'

module Middleman
class Generator < ::Thor::Group
include ::Thor::Actions

source_root File.expand_path(File.dirname(__FILE__))

def copy_default_files
directory 'template', '.', exclude_pattern: /\.DS_Store$/
end

def bundle_install
run 'bundle install'
end

def download_assets
run 'curl -L https://github.com/lewagon/stylesheets/archive/master.zip > stylesheets.zip'
run 'unzip stylesheets.zip -d source && rm stylesheets.zip'
run 'mv source/rails-stylesheets-master source/stylesheets'
run 'mv source/stylesheets/application.scss source/stylesheets/application.css.scss'
run 'rm source/stylesheets/README.md'
end

def generate_binstub
run 'bundle binstubs middleman-cli'
end
end
end
5 changes: 5 additions & 0 deletions template/.gitignore.tt
@@ -0,0 +1,5 @@
.bundle
.cache
.DS_Store
.sass-cache
build/
12 changes: 12 additions & 0 deletions template/Gemfile
@@ -0,0 +1,12 @@
source 'https://rubygems.org'

gem 'middleman', '~> 4.2'
gem 'middleman-autoprefixer', '~> 2.7'
gem 'middleman-sprockets'
gem 'middleman-deploy', git: 'https://github.com/lewagon/middleman-deploy.git'

# Assets
gem 'font-awesome-sass', '~> 4.2.0'
gem 'bootstrap-sass', '~> 3.3.1'
gem 'jquery-middleman'

20 changes: 20 additions & 0 deletions template/config.rb
@@ -0,0 +1,20 @@
activate :autoprefixer do |prefix|
prefix.browsers = "last 2 versions"
end

page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false

configure :build do
activate :minify_css
activate :minify_javascript
activate :asset_hash
activate :relative_assets
set :relative_links, true
end

activate :deploy do |deploy|
deploy.build_before = true
deploy.deploy_method = :git
end
Binary file added template/source/images/favicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions template/source/index.html.erb
@@ -0,0 +1,9 @@
---
title: Le Wagon - Middleman
---

<h1>
Congrats!
</h1>

<p>Le Wagon's middleman template is now set up.</p>
1 change: 1 addition & 0 deletions template/source/javascripts/application.js
@@ -0,0 +1 @@
// This is where it all goes :)
17 changes: 17 additions & 0 deletions template/source/layouts/layout.erb
@@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Use the title from a page's frontmatter if it has one -->
<title><%= current_page.data.title %></title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= favicon_tag 'images/favicon.png' %>
</head>
<body>
<%= yield %>
</body>
</html>

0 comments on commit ddea134

Please sign in to comment.