Still cant have the JS soft refresh with grunt running livereload.
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
livereload: {
options: {
port: 9001,
middleware: function(connect, options) {
return [lrSnippet, folderMount(connect, './')]
}
}
}
},
coffee: {
compile: {
files: {
// 'path/to/result.js': 'path/to/source.coffee', // 1:1 compile
'dist/js/app.js': ['src/js/*.coffee'] // compile and concat into single file
// 'dist/node/server.js': ['src/node/*.coffee'] // compile and concat into single file
}
},
glob_to_multiple: {
expand: true,
cwd: 'src/',
src: ['*.coffee'],
dest: 'dist/js/',
ext: '.js'
}
},
compass: { // Task
dist: { // Target
options: { // Target options
sassDir: 'src/sass',
cssDir: 'dist/css',
environment: 'production',
outputStyle: 'expanded',
debugInfo: true
}
},
dev: { // Another target
options: {
sassDir: 'src/sass',
cssDir: 'dist/css'
}
}
},
regarde: {
txt: {
files: ['src/sass/*.scss', 'src/js/*.coffee'],
tasks: ['compass', 'coffee']
},
css: {
files: ['dist/css/**/*.css', '*.html'],
tasks: ['livereload']
},
javascript: {
files: ['dist/js/**/*.js'],
tasks: ['livereload']
}
}
});
// Load the plugin that provides the "uglify" task.
// grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-regarde');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-compass');
// grunt.loadNpmTasks('grunt-coffeelint');
grunt.loadNpmTasks('grunt-devtools');
// Default task(s).
grunt.registerTask('default', ['livereload-start', 'connect', 'regarde']);
};