-
Notifications
You must be signed in to change notification settings - Fork 2
/
gruntfile.coffee
101 lines (85 loc) · 1.84 KB
/
gruntfile.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
'use strict'
module.exports = (grunt) ->
# Options
# =======
# Port offset
# -----------
# Increment this for additional gruntfiles that you want
# to run simultaneously.
portOffset = 0
# Host
# ----
# You could set this to your IP address to expose it over a local internet.
hostname = 'localhost'
# Configuration
# =============
grunt.initConfig
# Clean
# -----
# Configure 'grunt-contrib-clean' to remove all built and temporary
# files.
clean:
all: [
'temp'
]
# Copy
# ----
# Ensure files go where they need to. Used for static files.
copy:
static:
files: [
expand: true
filter: 'isFile'
cwd: 'src'
dest: 'temp'
src: [
'**/*'
]
]
# Webserver
# ---------
connect:
options:
port: 5000 + portOffset
hostname: hostname
middleware: (connect, options) -> [
require('connect-livereload')()
connect.static options.base
]
build:
options:
keepalive: true
base: 'build'
temp:
options:
base: 'temp'
# Watch
# -----
watch:
static:
files: ['src/**/*']
tasks: ['copy:static']
livereload:
options: {livereload: true}
files: ['temp/**/*']
# Dependencies
# ============
# Loads all grunt tasks from the installed NPM modules.
require('matchdep').filterDev('grunt-*').forEach grunt.loadNpmTasks
# Tasks
# =====
# Default
# -------
# By default, the invocation 'grunt' should build and expose the
# presentation at a default host/port.
grunt.registerTask 'default', [
'clean'
'server'
]
# Server
# ------
grunt.registerTask 'server', [
'copy:static'
'connect:temp'
'watch'
]