Created
November 18, 2014 19:35
-
-
Save naganowl/6a5f4af4b3bddd4294e5 to your computer and use it in GitHub Desktop.
Using `livereload` with `grunt-contrib-watch`
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
module.exports = (grunt) -> | |
# Load all grunt tasks matching the `grunt-*` pattern | |
require('load-grunt-tasks')(grunt) | |
grunt.initConfig | |
pkg: grunt.file.readJSON 'package.json' | |
# Only run tasks on modified files. | |
watch: | |
options: | |
spawn: no | |
interrupt: yes | |
dateFormat: (time) -> | |
grunt.log | |
.writeln("Compiled in #{time}ms @ #{(new Date).toString()} 💪\n") | |
livereload: | |
options: | |
livereload: yes | |
files: ['public/{javascripts,src,stylesheets}/**'] |
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
!!! 5 | |
%head | |
%meta{:charset => 'utf-8'}/ | |
%meta{:'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}/ | |
%title= App | |
%meta{ :name => "viewport", :content => "width=device-width, initial-scale=1.0, maximum-scale=1.0" } | |
%meta{ :name => "HandheldFriendly", :content => "true" } | |
- dev = App.development? | |
- if dev | |
%link{:rel => 'stylesheet', :href => asset_path('stylesheets/application.css')}/ | |
%script{:type => 'text/javascript', :src => asset_path('vendor/bower/requirejs/require.js')} | |
- else | |
%link{:rel => 'stylesheet', :href => asset_path('stylesheets/application.min.css')}/ | |
:javascript | |
#{output_server_data} | |
- if dev | |
:javascript | |
#{require_module_stuff} | |
-# livereload is supposed to be served from different port than the application. | |
%script{:type => 'text/javascript', :src => '//localhost:35729/livereload.js'} | |
%body | |
#nav.sidebar | |
.main | |
#content.container-fluid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment