Skip to content

Instantly share code, notes, and snippets.

@ohgyun
Last active December 15, 2015 23:39
Show Gist options
  • Save ohgyun/5342399 to your computer and use it in GitHub Desktop.
Save ohgyun/5342399 to your computer and use it in GitHub Desktop.
Gruntfile for livereload.
module.exports = function (grunt) {
// 라이브리로드를 위한 코드 파일
// https://github.com/gruntjs/grunt-contrib-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));
};
grunt.initConfig({
// 라이브리로드를 위한 웹서버 설정
connect: {
livereload: {
options: {
port: 8000,
base: './',
middleware: function(connect, options) {
return [lrSnippet, folderMount(connect, options.base)];
}
}
}
},
// 서버 개발 및 마크업 개발 시 파일 변경 감시를 위한 왓치 도구
regarde: {
development: {
files: [
'src/**/*.js'
],
tasks: ['livereload']
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-regarde');
grunt.registerTask('default', ['livereload-start', 'connect', 'regarde:development']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment