diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/README.md b/README.md new file mode 100755 index 0000000..5353bfe --- /dev/null +++ b/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 🚀 ! diff --git a/Thorfile b/Thorfile new file mode 100755 index 0000000..ea9925d --- /dev/null +++ b/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 diff --git a/template/.gitignore.tt b/template/.gitignore.tt new file mode 100755 index 0000000..0dcc3ec --- /dev/null +++ b/template/.gitignore.tt @@ -0,0 +1,5 @@ +.bundle +.cache +.DS_Store +.sass-cache +build/ diff --git a/template/Gemfile b/template/Gemfile new file mode 100755 index 0000000..df3aa4f --- /dev/null +++ b/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' + diff --git a/template/config.rb b/template/config.rb new file mode 100755 index 0000000..6dbeead --- /dev/null +++ b/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 diff --git a/template/source/images/favicon.png b/template/source/images/favicon.png new file mode 100644 index 0000000..13b8084 Binary files /dev/null and b/template/source/images/favicon.png differ diff --git a/template/source/index.html.erb b/template/source/index.html.erb new file mode 100755 index 0000000..57084d6 --- /dev/null +++ b/template/source/index.html.erb @@ -0,0 +1,9 @@ +--- +title: Le Wagon - Middleman +--- + +

+ Congrats! +

+ +

Le Wagon's middleman template is now set up.

diff --git a/template/source/javascripts/application.js b/template/source/javascripts/application.js new file mode 100755 index 0000000..9de6ff3 --- /dev/null +++ b/template/source/javascripts/application.js @@ -0,0 +1 @@ +// This is where it all goes :) diff --git a/template/source/layouts/layout.erb b/template/source/layouts/layout.erb new file mode 100755 index 0000000..39c8bd9 --- /dev/null +++ b/template/source/layouts/layout.erb @@ -0,0 +1,17 @@ + + + + + + + + <%= current_page.data.title %> + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= favicon_tag 'images/favicon.png' %> + + + <%= yield %> + +