Created
May 6, 2015 17:51
-
-
Save timcheadle/28e828bb9855202dd44f to your computer and use it in GitHub Desktop.
Middleman + Guard + shopify_theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
guard :shell do | |
watch(/source\/(.*)/) { |m| `bundle exec middleman build --clean` } | |
watch(/build\/(.*)/) do |m| | |
break if m[0] == 'build/config.yml' | |
store = '' | |
if File.exist?('build/config.yml') | |
config = YAML.load_file('build/config.yml') | |
store = config[:store] | |
end | |
file = Pathname.new(m[0]) | |
if file.exist? | |
puts "shopify (#{store}): uploading #{m[1]}" | |
`cd build && bundle exec theme upload #{m[1]}` | |
else | |
puts "shopify (#{store}): removing #{m[1]}" | |
`cd build && bundle exec theme remove #{m[1]}` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment