This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gruntfile.coffee
74 lines (60 loc) · 1.82 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
# Gruntfile for building the dataglobe project
module.exports = ( grunt ) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
clean:
[ 'build/tmp/components', 'build/tmp', 'build/*.js', 'public/<%= pkg.name %>.min.js' ]
cjsx:
options:
bare: true
files:
expand: true
flatten: true
cwd: 'src/components/'
src: ['*.cjsx']
dest: 'build/tmp/components'
ext: '.js'
coffee:
options:
bare: true # we don't want the wrapper function or else bad things
# happen with browserify
files:
expand: true
flatten: true
cwd: 'src/'
src: ['**/*.coffee']
dest: 'build/tmp'
ext: '.js'
browserify:
options:
debug: true
destFile: 'build/bundle.js'
src: [ 'build/tmp/**/*.js' ]
dev:
src: '<%= browserify.options.src %>'
dest: '<%= browserify.options.destFile %>'
production:
options:
debug: false
src: '<%= browserify.options.src %>'
dest: '<%= browserify.options.destFile %>'
uglify:
options:
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
dist:
files:
'public/<%= pkg.name %>.min.js': [ '<%= browserify.options.destFile %>' ]
watch:
files: [
'Gruntfile.coffee'
'src/**/*.coffee'
'src/**/*.cjsx'
]
tasks: 'default'
grunt.loadNpmTasks 'grunt-coffee-react'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-browserify'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.registerTask 'default', [ 'clean', 'cjsx', 'coffee', 'browserify:production', 'uglify' ]