-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.coffee
68 lines (53 loc) · 2.51 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
_ = require 'underscore'
fs = require 'fs'
BUILD_TASKS = ['copy', 'concat', 'coffee', 'stylus', 'jade']
RELEASE_TASKS = BUILD_TASKS.concat(['uglify:site', 'cssmin:site'])
copyOptions = (variant) ->
{files: [{expand: true, cwd: "client/site/views/examples/#{variant}/src/", src: '*', filter: 'isFile', dest: "client/site/views/examples/#{variant}/txt", rename: (dest, src) -> "#{dest}/#{src}.txt"}]}
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
clean:
assets: ['public/**/*']
copy:
vendor_assets: {files: [{expand: true, cwd: 'client/vendor/assets', src: '**', dest: 'public'}]}
site_assets: {files: [{expand: true, cwd: 'client/site/assets', src: '**', dest: 'public'}]}
'backbone-orm': copyOptions('backbone-orm')
'backbone-rest': copyOptions('backbone-rest')
'backbone-http': copyOptions('backbone-http')
'backbone-sql': copyOptions('backbone-sql')
'backbone-mongo': copyOptions('backbone-mongo')
'getting-started': copyOptions('getting_started')
coffee:
site: {expand: true, cwd: 'client/site/scripts', src: '**/*.coffee', dest: 'public/js', ext: '.js'}
jade:
site:
options:
client: false
pretty: true
src_path: 'client/site/examples/src/'
files: {'public/': ['client/site/views/**/*.jade']}
stylus:
site: {files: {'public/css/site.css': ['client/site/styles/*.styl']}}
concat:
vendor_styles: {src: 'client/vendor/styles/**/*', filter: 'isFile', dest: 'public/css/vendor.css'}
vendor_scripts: {src: 'client/vendor/scripts/**/*', filter: 'isFile', dest: 'public/js/vendor.js'}
uglify:
site: {expand: true, cwd: 'public/js/', src: ['*.js', '!*.min.js', '!*-min.js'], dest: 'public/js/', ext: '.js'}
cssmin:
site: {expand: true, cwd: 'public/css/', src: ['*.css', '!*.min.css', '!*-min.css'], dest: 'public/css/', ext: '.css'}
watch:
app:
files: ['client/**/*']
tasks: BUILD_TASKS
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-jade'
grunt.loadNpmTasks 'grunt-contrib-stylus'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-cssmin'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.registerTask 'default', ['clean'].concat(BUILD_TASKS).concat(['watch'])
grunt.registerTask 'release', ['clean'].concat(RELEASE_TASKS)