-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
92 lines (78 loc) · 2.38 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
path = require 'path'
module.exports = (grunt) ->
_ = grunt.util._
# Used instead of "ext" to accommodate filenames with dots. Lots of
# talk all over GitHub, including here: https://github.com/gruntjs/grunt/pull/750
coffeeRename = (dest, src) -> path.join dest, "#{ src.replace /\.(lit)?coffee$/, '.js' }"
# Project configuration.
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
coffee:
compile:
options:
sourceMap: true
files: [
expand: true
cwd: 'app/static/gardenproject/coffee'
src: ['**/*.?(lit)coffee']
dest: 'app/static/gardenproject/js/'
rename: coffeeRename
]
less:
compile:
files: [
expand: true
cwd: './app/static/gardenproject/less/'
src: ['**/*.less', '!**/_*.less']
dest: './app/static/gardenproject/css/'
ext: '.css'
]
watch:
options:
atBegin: true
coffee:
files: ['app/static/gardenproject/coffee/*.?(lit)coffee']
tasks: ['coffee']
less:
files: ['app/static/gardenproject/less/**/*.less']
tasks: ['less']
cssmin:
minify:
expand: true
cwd: 'app/static/gardenproject/css/'
src: ['*.css']
dest: 'app/static/gardenproject/css/'
ext: '.css'
options:
keepSpecialComments: 0
banner: '/* gardenproject created by HZDG */'
uglify:
all:
options:
mangle:
except: ['require']
files: [{
expand: true
cwd: 'app/static/gardenproject/js'
src: ['*.js']
dest: 'app/static/gardenproject/js'
}]
imagemin:
all:
files: [{
expand: true
cwd: 'app/static/gardenproject/img'
src: ['*.{png,jpg,gif}']
dest: 'app/static/gardenproject/img'
}]
# Load grunt plugins
grunt.loadNpmTasks 'grunt-contrib-less'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-cssmin'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-imagemin'
# Define tasks.
grunt.registerTask 'build', ['less', 'coffee',]
grunt.registerTask 'build:production', ['less', 'coffee', 'cssmin:all', 'uglify:all', 'imagemin:all']
grunt.registerTask 'default', ['build']