-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.coffee
More file actions
102 lines (87 loc) · 2.38 KB
/
Gruntfile.coffee
File metadata and controls
102 lines (87 loc) · 2.38 KB
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
102
"use strict"
path = require("path")
livereloadSnippet = require("grunt-contrib-livereload/lib/utils").livereloadSnippet
folderMount = (connect, point) ->
return connect.static(path.resolve(point))
module.exports = (grunt) ->
grunt.loadNpmTasks("grunt-contrib-clean")
grunt.loadNpmTasks("grunt-contrib-coffee")
grunt.loadNpmTasks("grunt-contrib-compass")
grunt.loadNpmTasks("grunt-symbolic-link");
grunt.loadNpmTasks("grunt-haml")
grunt.loadNpmTasks("grunt-contrib-concat")
grunt.loadNpmTasks("grunt-contrib-connect")
grunt.loadNpmTasks("grunt-contrib-livereload")
grunt.loadNpmTasks("grunt-regarde")
grunt.loadNpmTasks("grunt-contrib-copy")
# grunt.loadNpmTasks("grunt-contrib-uglify")
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
clean: ["build"]
compass:
all:
options:
config: "config.rb"
coffee:
all:
files: grunt.file.expandMapping(["src/**/*.coffee"], "", {
rename: (base, path) ->
path.replace(/^src\//, "build/").replace(/\.coffee$/, ".js")
})
haml:
all:
files: grunt.file.expandMapping(["src/**/*.haml"], "", {
rename: (base, path) ->
path.replace(/^src\//, "build/").replace(/\.haml$/, ".html")
})
copy:
all:
files: [
{ expand: true, cwd: "src", src: ["**/*.html"], dest: "build" }
]
concat:
js:
files:
"build/js/index.js": [
"src/js/vendor/jquery.js"
"build/js/string.js",
"src/js/vendor/three.js",
]
symlink:
assets:
target: "../src/assets"
link: "build/assets"
options:
force: true
overwrite: true
connect:
all:
options:
base: "build"
port: 8000
middleware: (connect, options) ->
[livereloadSnippet, folderMount(connect, options.base)]
livereload: { }
regarde:
coffee:
files: ["src/js/**/*.coffee"]
tasks: ["coffee", "concat:js"]
spawn: true
sass:
files: ["src/styles/**/*.sass"]
tasks: ["compass"]
spawn: true
haml:
files: ["src/**/*.haml"]
tasks: ["haml"]
spawn: true
copy:
files: ["src/**/*.html"]
tasks: ["copy"]
spawn: true
livereload:
files: ["assets/**", "build/**"]
tasks: ["livereload"]
grunt.registerTask("build", ["copy", "haml", "compass", "coffee", "concat", "symlink"])
grunt.registerTask("default", ["clean", "build"])
grunt.registerTask("server", ["clean", "build", "livereload-start", "connect", "regarde"])