Created
          March 1, 2013 07:49 
        
      - 
      
- 
        Save 2no/5063123 to your computer and use it in GitHub Desktop. 
    Mac + grunt 0.4.0 + grunt-devtools + grunt-contrib-livereload。 livereload の拡張機能を On にしつつ、devtools で livereload を開始すると livereload.js が読み込めずに自動リロードが機能しなくなる為、ブロウザの再読み込みを追加
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | module.exports = function(grunt) { | |
| 'use strict'; | |
| var path = require('path'), | |
| lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet, | |
| folderMount = function folderMount(connect, point) { | |
| return connect.static(path.resolve(point)); | |
| }; | |
| grunt.initConfig({ | |
| connect: { | |
| livereload: { | |
| options: { | |
| port: 9001, | |
| middleware: function(connect, options) { | |
| return [lrSnippet, folderMount(connect, '.')] | |
| } | |
| } | |
| } | |
| }, | |
| regarde: { | |
| fred: { | |
| files: ['*.html', '*.js'], | |
| tasks: ['livereload'] | |
| }, | |
| }, | |
| }); | |
| grunt.loadNpmTasks('grunt-devtools'); | |
| grunt.loadNpmTasks('grunt-regarde'); | |
| grunt.loadNpmTasks('grunt-contrib-connect'); | |
| grunt.loadNpmTasks('grunt-contrib-livereload'); | |
| grunt.registerTask('autoreload', ['browser-reload', 'livereload-start', 'connect', 'regarde']); | |
| grunt.registerTask('default', 'devtools'); | |
| // 参考:http://qiita.com/items/47100ac2ad4737770731 | |
| grunt.registerTask('browser-reload', 'reload Google Chrome (OS X)', function() { | |
| require('child_process').exec('osascript -e \'tell application \"Google Chrome\" to tell the active tab of its first window to reload\''); | |
| }); | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment