Skip to content

Instantly share code, notes, and snippets.

@xavez
Last active December 21, 2015 10:39
Show Gist options
  • Save xavez/6293288 to your computer and use it in GitHub Desktop.
Save xavez/6293288 to your computer and use it in GitHub Desktop.
Static site Guard setup. Use Compass, Jammit, Jekyll and LiveReload to compile static sites. 1. `cd` into project root 2. `gem update --system && gem install bundler && bundle install` 3. `bundle exec guard`
gzip_assets: off
javascript_compressor: closure-compiler
javascripts:
js/scripts-min:
- js/src/lib/*.js
- js/src/app.js
stylesheets:
css/style-min:
- css/style.css
destination: ./_site
exclude: ['scss','Gem*','Guard*','*.rb','.sass-cache','.git*','config.rb']
# ~/Gemfile
source "http://rubygems.org"
group :development do
# CSS Preprocessing
gem 'sass'
gem 'compass'
gem 'jekyll'
gem 'closure-compiler'
# Guard Specific
gem 'guard'
gem 'guard-compass'
gem 'guard-jekyll'
gem 'guard-jekyll-plus'
gem 'guard-livereload'
gem 'guard-jammit'
# Faster LiveReload
gem 'yajl-ruby'
end
# ~/.GuardFile
notification :off
# Sass/Compass https://github.com/guard/guard-compass
if File.exists?("./config.rb")
guard :compass do
watch(%r{(.*)\.s[ac]ss$})
end
end
# Jammit https://github.com/guard/guard-jammit
guard :jammit,
:output_folder => '.',
:config_path => "_assets.yml" do
watch(%r{(?:css|js)(/.+)\.(?:css|js)}) { |m| m[0] unless m[1] =~ /\/\./ }
end
# Jekyll
guard 'jekyll-plus', :config => ['_config.yml'] do
watch /.*/
ignore /_site/
end
# LiveReload https://github.com/guard/guard-livereload
require 'find'
if Find.find(Dir.pwd).detect{|dir|dir=~/.+\.(css|html|js)$/}
guard 'livereload', :grace_period => 0.5 do
watch(%r{.+\.(css|html|js)$})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment