|
'use strict' |
|
module.exports = (grunt) -> |
|
grunt.initConfig |
|
open: |
|
default: |
|
url: 'http://localhost:5000' |
|
|
|
reload: |
|
port: 5000 |
|
proxy: |
|
host: 'localhost' |
|
port: 8000 |
|
|
|
connect: |
|
default: |
|
options: |
|
base: './dist' |
|
|
|
coffee: |
|
compile: |
|
files: |
|
grunt.file.expandMapping(['app/scripts/**/*.coffee'], 'dist/scripts/', |
|
rename: (destBase, destPath) -> |
|
return destBase + destPath.slice(12, destPath.length).replace(/\.coffee$/, '.js') |
|
) |
|
|
|
sass: |
|
options: |
|
compass: true |
|
compile: |
|
files: |
|
'dist/stylesheets/main.css': 'app/stylesheets/main.sass' |
|
|
|
# Todo: change this to hamlc |
|
handlebars: |
|
compile: |
|
options: |
|
namespace: 'JST' |
|
processName: (filename) -> |
|
filename.substr(filename.lastIndexOf('/')+1, filename.length) |
|
files: |
|
'dist/scripts/templates.js': 'app/templates/**/*.hbs' |
|
|
|
# Todo: use require-cs instead |
|
requirejs: |
|
compile: |
|
options: |
|
name: "main" |
|
baseUrl: "./dist/scripts/" |
|
mainConfigFile: "./dist/scripts/main.js" |
|
optimize: "none" |
|
out: "./dist/scripts/app.js" |
|
|
|
watch: |
|
default: |
|
files: ['dist/index.html', 'app/scripts/**/*.coffee', 'app/stylesheets/**/*.sass', 'app/templates/**/*.hbs'] |
|
tasks: ['sass', 'coffee', 'handlebars', 'requirejs', 'reload'] |
|
|
|
grunt.loadNpmTasks 'grunt-contrib-connect' |
|
grunt.loadNpmTasks 'grunt-contrib-coffee' |
|
grunt.loadNpmTasks 'grunt-contrib-sass' |
|
grunt.loadNpmTasks 'grunt-contrib-watch' |
|
grunt.loadNpmTasks 'grunt-contrib-handlebars' |
|
grunt.loadNpmTasks 'grunt-open' |
|
grunt.loadNpmTasks 'grunt-reload' |
|
grunt.loadNpmTasks 'grunt-contrib-requirejs' |
|
|
|
grunt.registerTask 'build', ['coffee', 'sass', 'requirejs'] |
|
grunt.registerTask 'server', ['connect', 'open', 'reload', 'build', 'watch'] |
I've been playing around with GruntJS 0.4 and was not able to get the
grunt-reload
task working. Did you have success with this setup?