-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
114 lines (99 loc) · 3.16 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
102
103
104
105
106
107
108
109
110
111
112
113
114
module.exports = (grunt) ->
coffeeify = require "coffeeify"
stringify = require "stringify"
grunt.initConfig
connect:
sever:
options:
port: 3001
base: '.'
clean:
bin: ["bin"]
dist: ["dist"]
watch:
compile:
options:
livereload: true
files: ["src/**/*.coffee", "src/**/*.less", "src/**/*.html", "lib/**/*.js"]
tasks: ["browserify", "less"]
browserify:
dev:
options:
preBundleCB: (b)->
b.transform(coffeeify)
b.transform(stringify({extensions: [".hbs", ".html", ".tpl", ".txt"]}))
expand: true
flatten: true
src: ["src/coffee/main.coffee"]
dest: "bin/js"
ext: ".js"
less:
compile:
files:
"bin/css/style.css": ["src/less/style.less"]
uglify:
build:
files: [{
expand: true
cwd: "bin/js/"
src: ["**/*.js"]
dest: "dist/js"
ext: ".min.js"
}]
cssmin:
build:
files:
"dist/css/style.css": ["bin/css/style.css"]
copy:
css:
options:
process: (content, srcpath)->
return content.replace /\/assets/g, "../assets"
files:
"dist/css/style.css": ["bin/css/style.css"]
assets:
src: "assets/**/*"
dest: "dist/"
html:
options:
process: (content, srcpath)->
return content.replace(/\/assets/g, "./assets") \
.replace(/\/bin/g, ".").replace(/main.js/g, "main.min.js")
files:
"dist/index.html": ["src/index.html"]
imagemin:
dev:
files: [
expand: true
cwd: 'notminimgs'
src: ['*.{png, jpg, gif}']
dest: 'assets/'
]
grunt.loadNpmTasks "grunt-contrib-copy"
grunt.loadNpmTasks "grunt-contrib-connect"
grunt.loadNpmTasks "grunt-contrib-clean"
grunt.loadNpmTasks 'grunt-browserify'
grunt.loadNpmTasks "grunt-contrib-less"
grunt.loadNpmTasks "grunt-contrib-watch"
grunt.loadNpmTasks "grunt-contrib-uglify"
grunt.loadNpmTasks "grunt-contrib-cssmin"
grunt.loadNpmTasks "grunt-contrib-imagemin"
grunt.registerTask "default", ->
grunt.task.run [
"connect"
"clean:bin"
"browserify"
"less"
"watch"
]
grunt.registerTask "build", ->
grunt.task.run [
"clean:bin"
"clean:dist"
"browserify"
"less"
"uglify"
"cssmin"
"copy"
]
grunt.registerTask "min", ["imagemin"]