watch with live reload

This commit is contained in:
Radek Stepan 2014-09-14 09:33:15 -07:00
parent e6a8f85803
commit ec99547712
5 changed files with 17 additions and 4 deletions

View File

@ -65,11 +65,22 @@ module.exports = (grunt) ->
'public/css/app.min.css': 'public/css/app.css' 'public/css/app.min.css': 'public/css/app.css'
'public/css/app.bundle.min.css': 'public/css/app.bundle.css' 'public/css/app.bundle.min.css': 'public/css/app.bundle.css'
watch:
scripts:
files: "src/**/*.*"
tasks: [ "default" ]
options:
interrupt: true # interrupt build when a file has changed?
debounceDelay: 250 # delay a bit
livereload: true
grunt.loadNpmTasks('grunt-apps-c') grunt.loadNpmTasks('grunt-apps-c')
grunt.loadNpmTasks('grunt-contrib-stylus') grunt.loadNpmTasks('grunt-contrib-stylus')
grunt.loadNpmTasks('grunt-contrib-concat') grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-contrib-uglify') grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-cssmin') grunt.loadNpmTasks('grunt-contrib-cssmin')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.registerTask('default', [ grunt.registerTask('default', [
'apps_c' 'apps_c'

View File

@ -6,7 +6,7 @@ build:
grunt grunt
watch: watch:
watch --color -n 1 make build grunt watch
serve: serve:
cd public; python -m SimpleHTTPServer 8000 cd public; python -m SimpleHTTPServer 8000

View File

@ -8,7 +8,8 @@
"grunt-contrib-stylus": "~0.9.0", "grunt-contrib-stylus": "~0.9.0",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.5", "grunt-contrib-uglify": "~0.2.5",
"grunt-contrib-cssmin": "~0.6.2" "grunt-contrib-cssmin": "~0.6.2",
"grunt-contrib-watch": "~0.6.1"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -6,6 +6,7 @@
<link rel="stylesheet" type="text/css" href="css/app.bundle.css"> <link rel="stylesheet" type="text/css" href="css/app.bundle.css">
<script src="js/app.bundle.js"></script> <script src="js/app.bundle.js"></script>
<script src="http://0.0.0.0:35729/livereload.js"></script>
</head> </head>
<body> <body>
<script> <script>

View File

@ -8,7 +8,7 @@ module.exports = new Model
'items': [] 'items': []
init: -> init: ->
# Initialize with items if stored locally. # Initialize with items stored locally.
localforage.getItem 'projects', (items=[]) => localforage.getItem 'projects', (items=[]) =>
@set 'items', items @set 'items', items