-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.coffee
68 lines (59 loc) · 1.73 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
GruntVTEX = require 'grunt-vtex'
module.exports = (grunt) ->
pkg = grunt.file.readJSON 'package.json'
defaultConfig = GruntVTEX.generateConfig grunt, pkg
# Add custom configuration here as needed
customConfig =
coffee:
main:
files: [
expand: true
cwd: 'src/'
src: ['**/*.coffee']
dest: "build/<%= relativePath %>/"
rename: (path, filename) ->
path + filename.replace("coffee", "js")
]
coffeelint:
main:
src: ['src/**/*.coffee']
karma:
options:
configFile: 'karma.conf.coffee'
ci:
singleRun: true
dev:
singleRun: false
uglify:
main:
options:
sourceMap: true
sourceMapIncludeSources: true
files: [{
expand: true,
cwd: 'build/',
src: '**/*.js',
dest: 'build/'
}]
watch:
coffee:
files: ['src/**/*.coffee']
tasks: ['coffee']
tasks =
# Building block tasks
build: ['clean', 'coffee', 'copy:pkg']
min: ['uglify'] # minifies files
# Deploy tasks
dist: ['build', 'min', 'copy:deploy'] # Dist - minifies files
test: ['karma:ci']
devtest: ['karma:dev']
vtex_deploy: ['shell:cp', 'shell:cp_br']
# Development tasks
dev: ['nolr', 'build', 'watch']
default: ['build', 'connect', 'watch']
devmin: ['build', 'min', 'connect:http:keepalive'] # Minifies files and serve
# Project configuration.
grunt.config.init defaultConfig
grunt.config.merge customConfig
grunt.loadNpmTasks name for name of pkg.devDependencies when name[0..5] is 'grunt-' and name isnt 'grunt-vtex'
grunt.registerTask taskName, taskArray for taskName, taskArray of tasks