-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
107 lines (96 loc) · 2.37 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
module.exports = (grunt) ->
# load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
config =
aws: grunt.file.readJSON 'deploy.json'
charis: grunt.file.readJSON 'charis.json'
aws_s3:
options:
accessKeyId: '<%= aws.accessKeyId %>'
secretAccessKey: '<%= aws.secretAccessKey %>'
region: '<%= aws.region %>'
uploadConcurrency: 5
downloadConcurrency: 5
magazine:
options:
bucket: 'magazine.hicharis.net'
files: [
expand: true
cwd: '_site'
src: '**'
dest: '/'
]
open:
dev:
path: 'http://127.0.0.1:8080/articles.html'
app: 'Google Chrome'
magazine:
path: 'https://magazine.hicharis.net/articles.html'
app: 'Google Chrome'
shell:
jekyll:
command: 'jekyll build'
connect:
server:
options:
port: 8080
base: '_site'
sass:
dist:
options:
style: 'compressed'
loadPath: 'assets/css/_scss'
sourcemap: 'none'
files:
'_site/assets/css/style.css': 'assets/css/style.scss'
http:
sync:
options:
url: '<%= charis.endpoint %>'
method: 'PUT'
headers:
Authorization: (()->
md5 = require('md5')
charis = grunt.file.readJSON 'charis.json'
ts = Date.now()
token = new Buffer([
charis.clientId,
md5(charis.clientSecret + ts),
ts
].join(':')).toString('base64')
return 'Basic ' + token
)()
watch:
livereload:
files: [
'_config.yml'
'*.html'
'_layouts/**'
'_articles/**'
'_includes/**'
]
tasks: [
'shell:jekyll'
'sass:dist'
]
options:
livereload: true
sass:
files: [
'assets/css/**'
]
tasks: [
'sass:dist'
]
options:
livereload: true
grunt.initConfig config
grunt.registerTask 'default', [
'shell', 'connect', 'sass', 'open:dev', 'watch'
]
grunt.registerTask 'deploy', [
'shell', 'sass', 'aws_s3', 'open:magazine'
]
grunt.registerTask 'sync', [
'http:sync'
]