Skip to content

Instantly share code, notes, and snippets.

@crynobone
Created August 31, 2013 02:19
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 crynobone/6395836 to your computer and use it in GitHub Desktop.
Save crynobone/6395836 to your computer and use it in GitHub Desktop.
Guardfile for Laravel 4 projects.
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :less, :all_on_start => true, :all_on_start => false, :output => "public/css" do
watch(%r[^app/assets/less/(.+\.less)$])
end
guard 'coffeescript', :input => 'app/assets/coffee'
# Refresh the browser on save
guard 'livereload' do
watch(%r{.+(?<!\.min)\.(css|html|js|php|blade\.php)$})
end
guard :phpunit, :all_on_start => false, :tests_path => 'app/tests/', :cli => '--colors -c phpunit.xml' do
# Run any test in app/tests upon save.
watch(%r{^.+Test\.php$})
# When a view file is updated, run tests.
# Tip: you probably only want to run your integration tests.
watch(%r{app/views/.+\.php}) { Dir.glob('app/tests/**/*.php') }
# When a file is edited, try to run its associated test.
# Save app/models/User.php, and it will run app/tests/models/UserTest.php
watch(%r{^app/(.+)/(.+)\.php$}) { |m| "app/tests/#{m[1]}/#{m[2]}Test.php"}
end
# This will concatenate the javascript files specified in :files to public/js/all.js
guard :concat, type: "js", files: %w(), input_dir: "public/js", output: "public/js/application"
guard :concat, type: "css", files: %w(style), input_dir: "public/css", output: "public/css/application"
guard 'uglify', :destination_file => "public/js/application.min.js" do
watch (%r{public/js/application\.js})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment