All Projects → joshukraine → middleman-gulp

joshukraine / middleman-gulp

Licence: MIT License
A Middleman 4 template using Gulp.js via the external pipeline

Programming Languages

ruby
36898 projects - #4 most used programming language
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to middleman-gulp

Gulp Tutorial
Code examples for my Gulp.js tutorial series
Stars: ✭ 383 (+811.9%)
Mutual labels:  gulp, browserify, browsersync
branch
Branch Starter Theme - A WordPress starter theme based on Timber library and Bootstrap
Stars: ✭ 87 (+107.14%)
Mutual labels:  gulp, browsersync
adfab-gulp-boilerplate
A boilerplate including Gulp, Less/SASS, BrowserSync.
Stars: ✭ 17 (-59.52%)
Mutual labels:  gulp, browsersync
Frontend-StarterKit
Frontend StarterKit - [Gulp 4, Pug, SCSS, ES6+]
Stars: ✭ 13 (-69.05%)
Mutual labels:  gulp, browsersync
Gulp Webpack Starter
Gulp Webpack Starter - fast static website builder. The starter uses gulp toolkit and webpack bundler. Download to get an awesome development experience!
Stars: ✭ 199 (+373.81%)
Mutual labels:  gulp, browsersync
Forward-Framework
A killer WordPress theme framework built using underscores, gulp, sass, bourbon neat, bower & browsersync.
Stars: ✭ 23 (-45.24%)
Mutual labels:  gulp, browsersync
bootstrap-4-boilerplate
Basic Bootstrap 4 Starter Template
Stars: ✭ 50 (+19.05%)
Mutual labels:  gulp, browsersync
Web Starter Kit
Web Starter Kit is an opinionated boilerplate for web development. A solid starting point for both professionals and newcomers to the industry.
Stars: ✭ 130 (+209.52%)
Mutual labels:  gulp, browsersync
sage-starter
The best starter theme with a modern front-end development workflow. Based on Sage, HTML5 Boilerplate, gulp, Bower, and Bootstrap.
Stars: ✭ 42 (+0%)
Mutual labels:  gulp, browsersync
email-framework
A simple, gulp powered framework to develop and test responsive emails.
Stars: ✭ 19 (-54.76%)
Mutual labels:  gulp, browsersync
selene
A opinionated Wordpress base theme based on Sage.
Stars: ✭ 31 (-26.19%)
Mutual labels:  gulp, browsersync
Gopablo
🐺 Static site generator.
Stars: ✭ 166 (+295.24%)
Mutual labels:  gulp, browsersync
Bootstrap 4 Boilerplate
Bootstrap 4.3.1 boilerplate with Browsersync, Sass and Gulp.js
Stars: ✭ 155 (+269.05%)
Mutual labels:  gulp, browsersync
magento-2-gulp
Gulp for Magento 2. It works with core Magento styles (less) and structure. Uses default theme configs from dev/tools/grunt/configs/local-themes.js.
Stars: ✭ 37 (-11.9%)
Mutual labels:  gulp, browsersync
Generator Phaser Plus
[🛑 DISCONTINUED] It has been a long journey but development of `generator-phaser-plus` is now over. I recommend you have a look and fork `yandeu/phaser-project-template` instead.
Stars: ✭ 148 (+252.38%)
Mutual labels:  gulp, browsersync
frontie
Frontie is a front-end boilerplate. Gulp | Twig.js | Sass | Autoprefixer | Browsersync | Bootstrap 4 Grid System & Responsive Breakpoints
Stars: ✭ 28 (-33.33%)
Mutual labels:  gulp, browsersync
gupack
基于gulp的前端构建工具
Stars: ✭ 13 (-69.05%)
Mutual labels:  gulp, browserify
Bootstrap 4 Sass Gulp 4 Boilerplate
A Bootstrap 4.5.2 boilerplate with font-awesome, sass, gulp 4 tasks
Stars: ✭ 103 (+145.24%)
Mutual labels:  gulp, browsersync
Gulp Bro
👊 gulp + browserify + incremental build, done right.
Stars: ✭ 119 (+183.33%)
Mutual labels:  gulp, browserify
gw-starter-kit
PEPELAC - Современный инструментарий для вёрстки и создания статичных сайтов с использованием Webpack
Stars: ✭ 30 (-28.57%)
Mutual labels:  gulp, browsersync

Middleman 4 + Gulp.js

Build Status

This is a Middleman template which implements Gulp.js using the new external pipeline feature introduced in Middleman 4.

Features

Requirements

Usage

  1. Start a new Middleman site using this template.

     $ middleman init my_new_site -T joshukraine/middleman-gulp
    
  2. Change into the project root and execute the setup script.

     $ cd my_new_site
     $ chmod +x bin/* # Make sure we can run included scripts
     $ bin/setup
    
  3. Start the Middleman server. Note that this will also invoke Gulp via the external pipeline.

     $ bundle exec middleman server
    
  4. Initialize a new Git repo.

     $ git init
     $ git add --all
     $ git commit -m "Initial commit"
     $ git remote add origin https://[your-repo-url]
     $ git push -u origin master
    

Deployment

I recommend Amazon S3 for deployment. It's very simple and surprisingly cost effective. Here's how to deploy your site to S3.

  1. Read Amazon's guide on Hosting a Static Website

  2. In the Gemfile, uncomment and install middleman-s3_sync

  3. Configure your deployment configs in environments/production.rb and environments/staging.rb.

  4. To deploy, run the deploy script, passing your desired environment as an argument.

     $ bin/deploy production
    
     # OR...
     $ bin/deploy staging
    

BONUS: If you deploy with Amazon, you can get a free ssl certificate for your site!

Environments

Middleman has two default environments: development and production. This template is configured to run the external pipeline (Gulp in our case) in both. There are times, however, when the external pipeline should not run. Two good examples are tests and the console. We therefore define two additional environments: test and console.

Custom environments can be invoked on the command line with -e flag like so:

# Start the console in the console enviroment
$ bundle exec middleman console -e console

Code for custom environments is stored in environments/<your-custom-env>.rb. Note that custom environments can be invoked without the existence of a corresponding file in the environments/ directory. If, for example, you merely wanted to start a server without the default development configs, you could run middleman server -e <anything-here>.

For completeness, all five environments used in this template have corresponding files:

environments/
├── console.rb
├── development.rb
├── production.rb
├── staging.rb
└── test.rb

Middleman vs. Gulp

As I initially experimented with Gulp and Middleman, it was sometimes difficult to determine which tool should handle which tasks. The problem is that, while Gulp and Middleman are very different, they have a fair amount of overlapping functionality. For example, Middleman can minify your CSS and JavaScript right out of the box. So can Gulp. Middleman can also minify your HTML, gzip your files, and automatically reload your browser using LiveReload. And Gulp can do all these things too.

So how do you decide who does what? I think most people would be inclined to have Gulp do it all. That's what it was designed for, and it makes sense to keep all these asset-related tasks in one place. However, since we're using Gulp inside of Middleman - a robust static site generator - I think there are some tasks that are better left to Middleman. Here's how I've broken it down in this template:

Middleman Gulp
HTML Templating
Minify HTML
Gzip Files
Preprocess CSS
Minify CSS
Minify Javascript
Sourcemaps
Autoprefixer
Bundle JavaScript
Compress Images
Copy web fonts
Browser Reload

Tests

Testing is done with Rspec. A few basic tests are provided as an example. Run your test suite like so:

$ bin/rspec spec/

Aliases

Consider adding the following to your .bashrc or .zshrc file:

mm='bundle exec middleman'
mmb='bundle exec middleman build --clean'
mmc='bundle exec middleman console -e console'
mms='bundle exec middleman server'

Acknowledgements

The following repos were very helpful in setting up this template.

Reference

License

Copyright © 2018 Joshua Steele. MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].