-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.coffee
77 lines (63 loc) · 1.53 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
module.exports = (grunt) ->
'use strict'
# Track execution time
require('time-grunt') grunt;
# Load grunt tasks automatically
require('jit-grunt') grunt
# Define the configuration for all the tasks
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
# Specify environment variables
env:
tinypng:
api:
key: do ->
envKey = process.env.TINYPNG_API_KEY
if envKey
grunt.log.ok('Reading tinypng API key from environment')
return envKey
else
grunt.log.ok('Reading tinypng API key from `tinypng.yml`')
return grunt.file.readYAML('tinypng.yml').key
# Specify your source and build directory structure
path:
source:
root: 'source'
images: '<%= path.source.root %>/images'
watermark: '<%= path.source.root %>/watermark'
build:
root: 'build'
images: '<%= path.build.root %>'
# Specify files
file:
source:
watermark: '<%= path.source.watermark %>/logo.png'
build:
images:
hash: '<%= path.build.images %>/hash.json'
grunt.loadTasks 'tasks'
###
Default task
###
grunt.registerTask 'default', [
'clean'
'gm'
'size_report'
'watch'
]
###
A task for your production environment
###
grunt.registerTask 'build', [
'clean'
'gm'
'tinypng'
'size_report'
]
###
A task for a static server with a watch
###
grunt.registerTask 'serve', [
'watch'
]
return