forked from pimatic/pimatic-mobile-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
46 lines (37 loc) · 1.19 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
# Grunt configuration updated to latest Grunt. That means your minimum
# version necessary to run these tasks is Grunt 0.4.
#
# Please install this locally and install `grunt-cli` globally to run.
module.exports = (grunt) ->
notMinified = (f) => f.indexOf('.min.') is -1
toMin = (f) => f.replace(/\.[^\.]+$/, '.min$&')
coffeeToJs = (f) => f.replace(/\.coffee$/, '.js')
jsFiles = {}
grunt.file.expand(filter: notMinified,[
'app/*.js'
'app/**/*.js'
]).forEach((f) => jsFiles[toMin f] = [f])
coffeeFiles = {}
grunt.file.expand([
'app/*.coffee'
'app/**/*.coffee'
]).forEach((f) => coffeeFiles["compiled/#{coffeeToJs f}"] = f)
coffeeFilesToUglify = {}
for compiled, source of coffeeFiles
coffeeFilesToUglify[toMin coffeeToJs(source)] = compiled
# Initialize the configuration.
grunt.initConfig(
coffee:
default:
files: coffeeFiles
uglify:
js:
files: jsFiles
coffee:
files: coffeeFilesToUglify
)
# Load external Grunt task plugins.
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-coffee'
# Default task.
grunt.registerTask "default", ["coffee", "uglify:coffee" , "uglify:js"]