Skip to content

Instantly share code, notes, and snippets.

@timcheadle
Created May 6, 2015 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timcheadle/28e828bb9855202dd44f to your computer and use it in GitHub Desktop.
Save timcheadle/28e828bb9855202dd44f to your computer and use it in GitHub Desktop.
Middleman + Guard + shopify_theme
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