forked from vtex/front.i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
101 lines (81 loc) · 2.33 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
module.exports = (grunt) ->
pkg = grunt.file.readJSON('package.json')
# Project configuration.
grunt.initConfig
# App variables
relativePath: ''
clean: ['build', 'dist']
copy:
main:
expand: true
cwd: 'src/'
src: ['**', '!coffee/**', '!**/*.less']
dest: 'build/<%= relativePath %>'
test:
expand: true
cwd: 'spec/'
src: ['**', '!**/*.coffee']
dest: 'build/<%= relativePath %>/spec/'
coffee:
main:
expand: true
cwd: 'src/coffee'
src: ['**/*.coffee']
dest: 'build/<%= relativePath %>/js/'
ext: '.js'
dist:
expand: true
cwd: 'src/coffee'
src: ['vtex-i18n.coffee', 'vtex-locale-selector.coffee']
dest: 'dist/<%= relativePath %>/'
ext: '.js'
less:
main:
files:
'build/<%= relativePath %>/style/main.css': 'src/style/main.less'
useminPrepare:
html: 'build/<%= relativePath %>/index.html'
usemin:
html: 'build/<%= relativePath %>/index.html'
uglify:
dist:
files:
'dist/vtex-i18n.min.js': ['dist/vtex-i18n.js']
'dist/vtex-locale-selector.min.js': ['dist/vtex-locale-selector.js']
karma:
options:
configFile: 'karma.conf.coffee'
unit:
background: true
deploy:
singleRun: true
connect:
dev:
options:
port: 9001
base: 'build/'
watch:
options:
livereload: true
dev:
files: ['src/**/*.html', 'src/**/*.coffee', 'src/**/*.js', 'src/**/*.less']
tasks: ['dev']
prod:
files: ['src/**/*.html', 'src/**/*.coffee', 'src/**/*.js', 'src/**/*.less']
tasks: ['prod']
test:
files: ['src/**/*.html', 'src/**/*.coffee', 'src/**/*.js', 'src/**/*.less', 'spec/**/*.*']
tasks: ['dev', 'karma:unit:run']
grunt.loadNpmTasks name for name of pkg.devDependencies when name[0..5] is 'grunt-'
grunt.registerTask 'default', ['dev-watch']
# Dev
grunt.registerTask 'dev', ['clean', 'copy', 'coffee', 'less']
grunt.registerTask 'dev-watch', ['dev', 'connect', 'watch:dev']
# Prod - minifies files
grunt.registerTask 'prod', ['dev', 'useminPrepare', 'concat', 'uglify', 'cssmin', 'usemin']
grunt.registerTask 'prod-watch', ['prod', 'connect', 'watch:prod']
# Test
grunt.registerTask 'test', ['dev', 'connect' ,'karma:deploy']
grunt.registerTask 'tdd', ['dev', 'connect', 'karma:unit', 'watch:test']
# Dist
grunt.registerTask 'dist', ['clean', 'coffee:dist', 'uglify:dist']