Skip to content

Instantly share code, notes, and snippets.

@jayhjkwon
Created June 27, 2013 02:51
Show Gist options
  • Save jayhjkwon/5873600 to your computer and use it in GitHub Desktop.
Save jayhjkwon/5873600 to your computer and use it in GitHub Desktop.
Gruntfile.js with livereload configuration
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch : {
options: {
livereload: true
},
less : {
tasks : 'less:development',
files : ['**/*.less']
},
coffee : {
tasks : 'coffee',
files : ['**/*.coffee']
},
html : {
files : ['**/*.html']
}
},
coffee: {
compile: {
options:{
bare: true,
sourceMap : true
},
files: [
{
expand: true,
cwd: './js/',
src: ['**/*.coffee'],
dest: './js/',
ext: '.js'
}
]
}
},
qunit: {
all: {
options: {
urls: ['http://localhost:8080/js/tests/test.html']
}
}
},
requirejs: {
compile: {
options: {
baseUrl : './js',
mainConfigFile: './js/require-config.js',
out : './js/app.min.js',
locale : "ko-kr",
name : 'app',
include : ['require-config'],
exclude : ['jquery'],
optimize : 'none'
}
}
},
less: {
development: {
options: {
paths : ['./less/app']
},
files: {
'./css/app/app-dev.min.css': './less/app/style.less'
}
},
production: {
options: {
paths : ['./less/app'],
yuicompress: 'true'
},
files : {
'./css/app/app.min.css': './less/app/style.less'
}
}
}
});
// Load tasks from NPM
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-watch');
// register task.
grunt.registerTask('default', ['coffee', 'qunit', 'requirejs', 'less']);
};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>XDS Viewer</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Development Mode -->
<link href="./css/app/app-dev.min.css" rel="stylesheet" />
<!-- Release Mode -->
<!--<link href="./css/app/app.min.css" rel="stylesheet" />-->
</head>
<body>
<!-- Development Mode -->
<script src="http://localhost:35729/livereload.js"></script>
<!-- Release Mode -->
<!--<script data-main="./js/app.min" src="./js/vendor/require-jquery.js"></script>-->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment