Skip to content

Instantly share code, notes, and snippets.

@kenelliott
Created February 26, 2014 16:21
Show Gist options
  • Select an option

  • Save kenelliott/9232920 to your computer and use it in GitHub Desktop.

Select an option

Save kenelliott/9232920 to your computer and use it in GitHub Desktop.
watch:
options:
livereload: true
templates:
files: "#{srcFolder}/templates/**/*.hbs"
options:
nospawn: true
coffee:
files: "#{srcFolder}/**/*.coffee"
options:
sourceMap: true
sourceRoot: ""
less:
files: "#{srcFolder}/**/*.less"
html:
files: "#{srcFolder}/**/*.html"
tasks: ["copy"]
grunt.event.on "watch", (action, filepath) ->
cwd = "#{srcFolder}"
filepath = filepath.replace cwd, ""
ext = path.extname(filepath)
isCoffee = ext == ".coffee"
isHTML = ext == ".html"
isHBS = ext == ".hbs"
if isHTML
grunt.config.set "copy",
templates:
files: [
expand: true
cwd: cwd
src: filepath
dest: devFolder
]
grunt.task.run "copy:templates"
if isCoffee
grunt.config.set "coffee",
options: lintOptions
changed:
bare: false
expand: true
cwd: cwd
src: filepath
dest: "#{devFolder}/app/app.js"
options:
sourceMap: true
sourceRoot: ""
grunt.config.set "coffeelint",
options: lintOptions
newSources:
files: [
expand: true
cwd: cwd
src: filepath
]
grunt.task.run "coffeelint:newSources"
grunt.task.run "coffee:changed"
if isHBS
grunt.task.run "ember_handlebars:dev"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment