-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.coffee
52 lines (48 loc) · 1.52 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
module.exports = (grunt) ->
grunt.initConfig
stylus:
compile:
options:
compress: off
files:
'public/css/clonkspot.css': 'css/*.styl'
'public/css/pages.css': 'css/pages/*.styl'
browserify:
home:
files: 'public/js/home.js': 'js/home.coffee'
games:
files: 'public/js/games.js': 'js/games.coffee'
coffee:
header:
files: 'public/js/header.js': 'js/header.coffee'
watch:
stylus:
files: 'css/**/*.styl'
tasks: 'stylus'
browserify:
files: 'js/**/*'
tasks: ['browserify', 'coffee']
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-stylus'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.registerTask 'default', ['stylus', 'browserify', 'coffee']
grunt.registerMultiTask 'browserify', 'Runs browserify', ->
browserify = require 'browserify'
for file, i in @files
b = browserify(@options())
b.addEntry(f) for f in file.src
bundle = b.bundle()
grunt.file.write file.dest, bundle
return
grunt.registerTask 'layout', 'Create the static layout files', ->
done = @async()
request = require('supertest')(require('./app').app)
['de', 'en'].forEach (lang) ->
request.get('/_layout')
.set('Accept-Language', lang)
.expect(200)
.end (err, res) ->
throw err if err
for key, content of res.body
grunt.file.write "public/layout/#{key}-#{lang}.html", content
done()