This repository has been archived by the owner on May 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgruntfile.coffee
158 lines (140 loc) · 3.84 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Gettext = require('./modules/gettext')
module.exports = (grunt) ->
'use strict'
# Track execution time
require('time-grunt') grunt
# Load grunt tasks automatically
require('jit-grunt') grunt,
nunjucks: 'grunt-nunjucks-2-html'
sprite: 'grunt-spritesmith'
# Define the configuration for all the tasks
grunt.initConfig
# Specify environment variables
env:
sitename: process.env.SITENAME
production: process.env.PRODUCTION == 'true' or grunt.option('production')
staging: process.env.STAGING == 'true' or grunt.option('staging')
build: grunt.cli.tasks.includes('build')
hotModuleRloading: grunt.option('hmr')
tinypng:
api:
key: process.env.TINYPNG_API_KEY
github:
api:
key: process.env.GITHUB_API_KEY
# Specify your source and build directory structure
path:
tasks:
root: 'tasks'
source:
root: 'source'
data: '<%= path.source.root %>/data'
fonts: '<%= path.source.root %>/fonts'
icons: '<%= path.source.root %>/icons'
images: '<%= path.source.root %>/images'
locales: '<%= path.source.root %>/locales'
scripts: '<%= path.source.root %>/scripts'
sprites: '<%= path.source.root %>/sprites'
static: '<%= path.source.root %>/static'
styles: '<%= path.source.root %>/styles'
templates: '<%= path.source.root %>/templates'
temp:
root: 'temp'
data: '<%= path.temp.root %>/data'
styles: '<%= path.temp.root %>/styles'
build:
root: 'build'
assets: '<%= path.build.root %>/assets'
fonts: '<%= path.build.assets %>/fonts'
images: '<%= path.build.assets %>/images'
scripts: '<%= path.build.assets %>/scripts'
sprites: '<%= path.build.assets %>/sprites'
static: '<%= path.build.root %>'
styles: '<%= path.build.assets %>/styles'
templates: '<%= path.build.root %>'
# Specify files
file:
source:
script: '<%= path.source.scripts %>/main.js'
temp:
data:
matter: '<%= path.temp.data %>/matter.json'
build:
script:
compiled: '<%= path.build.scripts %>/main.js'
style:
tidy: '<%= path.build.styles %>/style.tidy.css'
sprite:
compiled: '<%= path.build.sprites %>/sprite.png'
hash: '<%= path.build.sprites %>/hash.json'
locales:
'en-US':
locale: 'en-US'
url: '/'
rtl: false
defaultForLanguage: true
numberFormat: '0,0.[00]'
currencyFormat: '$0,0.00'
'ru-RU':
locale: 'ru-RU'
url: '/ru'
rtl: false
defaultForLanguage: true
numberFormat: '0,0.[00]'
currencyFormat: '0,0.00 $'
baseLocale: 'en-US'
grunt.config.merge
gettext: new Gettext({ cwd: grunt.config('path.source.locales') })
data: require('./' + grunt.config('path.source.data'))(grunt)
grunt.loadTasks grunt.config('path.tasks.root')
###
Default task
###
grunt.registerTask 'default', [
'clean:build'
'copy'
'grayMatter'
'nunjucks'
'sprite'
'webfont'
'sass'
'postcss:autoprefix'
'responsive_images:thumbnails'
'responsive_images_extender'
'browserSync'
'watch'
]
###
A task for your production environment
###
grunt.registerTask 'build', [
'clean'
'copy'
'grayMatter'
'nunjucks'
'sprite'
'webfont'
'sass'
'postcss:autoprefix'
'shell:jspm_build'
'uglify'
'uncss'
'csso'
'responsive_images:thumbnails'
'responsive_images_extender'
'htmlmin'
'tinypng'
'clean:styles'
'clean:scripts'
'cacheBust'
'sitemap_xml'
'size_report'
]
###
A task for a static server with a watch
###
grunt.registerTask 'serve', [
'browserSync'
'watch'
]
return grunt