-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.coffee
121 lines (106 loc) · 2.61 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
module.exports = (grunt) ->
grunt.initConfig
# Преобразуем slim в html
slim:
dist:
files: [
expand: true
cwd: 'development'
src: ['{,*/}*.slim']
dest: 'production'
ext: '.html'
]
# Преобразуем coffee в js
coffee:
options:
bare: true
sourceMap: true
dist:
files: [
expand: true
cwd: 'development/coffee'
src: ['{,*/}*.coffee']
dest: 'tmp/js'
ext: '.js'
]
# Преобразуем stylus в css
stylus:
dist:
files: [
expand: true
cwd: 'development/stylus'
src: ['{,*/}*']
dest: 'tmp/css'
ext: '.css'
]
# Добавляем префиксы
autoprefixer:
options:
browsers: ['> 3%', 'last 2 version']
dist:
files: [
expand: true
cwd: 'tmp/css'
src: ['{,*/}*.css']
dest: 'tmp/css'
ext: '.css'
]
# Минимизируем js и конкатенируем
uglify:
dist:
files: [
expand: true
cwd: 'tmp/js'
src: ['{,*/}*.js']
dest: 'production/js'
ext: '.js'
]
# Копируем сорсмапы
copy:
dist:
files: [
expand: true
cwd: 'tmp/js'
src: ['{,*/}*.map']
dest: 'production/js'
ext: '.map'
]
# Минимизируем css и конкатенируем
cssmin:
dist:
files:
'./production/css/styles.css': './tmp/css/*.css'
# Отслеживаем изменения автоматически
watch:
styles:
files: ['development/stylus/*.styl']
tasks: ['stylus','autoprefixer','cssmin']
scripts:
files: ['development/coffee/*.coffee']
tasks: ['coffee','uglify']
markup:
files: ['development/*.slim']
tasks: ['slim']
copy:
files: ['tmp/js/*.map']
tasks: ['copy']
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-slim'
grunt.loadNpmTasks 'grunt-autoprefixer'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-stylus'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-cssmin'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.registerTask 'watcher', [
'watch'
]
grunt.registerTask 'default', [
'slim'
'coffee'
'stylus'
'autoprefixer'
'uglify'
'cssmin'
'copy'
]