-
-
Save swalkinshaw/8890919e3a8a72b4b495 to your computer and use it in GitHub Desktop.
Grunt livereload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
path = require 'path' | |
modRewrite = require 'connect-modrewrite' | |
module.exports = (grunt) -> | |
grunt.initConfig | |
qunit: | |
all: ['tests/**/*.html'] | |
clean: | |
all: ['.tmp/**/*.*', 'public/css', 'public/js'] | |
copy: | |
static: | |
files:[ | |
expand: true | |
cwd: 'app' | |
src: [ | |
'**/*.html' | |
'images/*' | |
'fonts/*' | |
] | |
dest: 'public/' | |
] | |
coffee: | |
options: | |
bare: true | |
sourceMap: true | |
glob_to_multiple: | |
expand: true | |
cwd: '' | |
src: [ | |
'app/**/*.coffee' | |
'tests/**/*.coffee' | |
] | |
dest: '.tmp/js' | |
ext: '.js' | |
commonjs: | |
modules: | |
cwd: '.tmp/js/app/js/' | |
src: '**/*.js' | |
dest: '.tmp/js/app/js/' | |
fixtures: | |
cwd: '.tmp/js/tests/fixtures' | |
src: '**/*.js' | |
dest: '.tmp/js/tests/fixtures' | |
stylus: | |
compile: | |
files: | |
'public/css/application.css': ['app/**/*.styl'] | |
cssmin: | |
compress: | |
files: | |
'public/css/application.css': ['public/css/application.css'] | |
emberTemplates: | |
compile: | |
options: | |
templateName: (sourceFile) -> | |
sourceFile.replace /app\/js\/templates\//, '' | |
files: | |
'.tmp/js/app/templates.js': ['app/**/*.handlebars'] | |
concat: | |
styles: | |
src: [ | |
'vendor/normalize.css' | |
'public/css/application.css' | |
] | |
dest: 'public/css/application.css' | |
tests: | |
src: [ | |
'tests/{integration,unit,fixtures}/**/*.js' | |
'.tmp/js/tests/**/*.js' | |
] | |
dest: 'tests/test_bundle.js' | |
precompile: | |
src: [ | |
'vendor/jquery.js' | |
'vendor/common.js' | |
'vendor/handlebars.runtime.js' | |
'vendor/ember.min.js' | |
'vendor/ember-data.min.js' | |
'.tmp/js/app/templates.js' | |
'.tmp/js/app/js/**/*.js' | |
] | |
dest: 'public/js/application.js' | |
scripts: | |
src: [ | |
'vendor/jquery.js' | |
'vendor/common.js' | |
'vendor/handlebars.runtime.js' | |
'vendor/ember.js' | |
'vendor/ember-data.js' | |
'.tmp/js/app/templates.js' | |
'.tmp/js/app/js/**/*.js' | |
] | |
dest: 'public/js/application.js' | |
uglify: | |
precompile: | |
files: | |
'public/js/application.js': ['public/js/application.js'] | |
watch: | |
options: | |
livereload: 35729 | |
coffee: | |
files: 'app/js/**/*.coffee' | |
tasks: ['default'] | |
options: | |
livereload: true | |
handlebars: | |
files: 'app/**/*.handlebars' | |
tasks: ['default'] | |
options: | |
livereload: true | |
stylus: | |
files: 'app/**/*.styl' | |
tasks: ['default'] | |
options: | |
livereload: true | |
static: | |
files: [ | |
'app/**/*.html' | |
'app/images/*' | |
'app/fonts/*' | |
] | |
tasks: ['default'] | |
options: | |
livereload: true | |
tests: | |
files: ['tests/integration/**/*.js', 'tests/integration/**/*.coffee'] | |
tasks: ['test'] | |
options: | |
livereload: true | |
connect: | |
server: | |
options: | |
base: 'public' | |
middleware: (connect, options) -> | |
[ | |
modRewrite [ | |
'!\\.?(js|css|html|eot|svg|ttf|woff|otf|css|png|jpg|git|ico) / [L]' | |
] | |
require('connect-livereload')() | |
connect.static options.base | |
] | |
grunt.loadNpmTasks 'grunt-contrib-coffee' | |
grunt.loadNpmTasks 'grunt-contrib-uglify' | |
grunt.loadNpmTasks 'grunt-contrib-stylus' | |
grunt.loadNpmTasks 'grunt-contrib-cssmin' | |
grunt.loadNpmTasks 'grunt-ember-templates' | |
grunt.loadNpmTasks 'grunt-contrib-concat' | |
grunt.loadNpmTasks 'grunt-commonjs' | |
grunt.loadNpmTasks 'grunt-contrib-clean' | |
grunt.loadNpmTasks 'grunt-contrib-watch' | |
grunt.loadNpmTasks 'grunt-contrib-qunit' | |
grunt.loadNpmTasks 'grunt-contrib-copy' | |
grunt.loadNpmTasks 'grunt-contrib-connect' | |
grunt.registerTask 'default', [ | |
'clean' | |
'coffee' | |
'commonjs:modules' | |
'stylus' | |
'emberTemplates' | |
'concat:scripts' | |
'concat:styles' | |
'copy:static' | |
] | |
grunt.registerTask 'server', [ | |
'default' | |
'connect:server:keepalive' | |
] | |
grunt.registerTask 'dev', [ | |
'default' | |
'connect:server' | |
'watch' | |
] | |
grunt.registerTask 'precompile', [ | |
'clean' | |
'coffee' | |
'commonjs' | |
'stylus' | |
'emberTemplates' | |
'concat:precompile' | |
'concat:styles' | |
'uglify' | |
'cssmin' | |
] | |
grunt.registerTask 'test', [ | |
'default' | |
'commonjs:fixtures' | |
'concat:tests' | |
'qunit' | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "site", | |
"version": "0.0.1", | |
"description": "", | |
"repository": "", | |
"author": "", | |
"license": "BSD", | |
"devDependencies": { | |
"grunt": "~0.4.1", | |
"grunt-contrib-coffee": "~0.6.0", | |
"grunt-contrib-stylus": "~0.4.1", | |
"grunt-contrib-concat": "~0.1.3", | |
"grunt-commonjs": "~0.2.0rc7", | |
"grunt-contrib-clean": "~0.4.0", | |
"grunt-contrib-uglify": "~0.2.0", | |
"grunt-ember-templates": "0.4.7", | |
"grunt-contrib-cssmin": "~0.6.0", | |
"grunt-contrib-qunit": "~0.2.1", | |
"grunt-contrib-watch": "latest", | |
"grunt-contrib-copy": "latest", | |
"grunt-contrib-connect": "~0.3.0", | |
"connect-modrewrite": "~0.3.16", | |
"connect-livereload": "~0.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment