forked from Hill30/NGScroller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.coffee
More file actions
126 lines (113 loc) · 2.63 KB
/
Gruntfile.coffee
File metadata and controls
126 lines (113 loc) · 2.63 KB
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
# Build configurations.
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-karma'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.initConfig
connect:
app:
options:
base: './src/'
middleware: require './server/middleware'
port: 5001
watch:
options:
livereload: false
karma:
unit:
options:
autoWatch: true
colors: true
configFile: './test/karma.conf.js'
keepalive: true
port: 8081
runnerPort: 9100
travis:
options:
colors: true
configFile: './test/karma.conf.js'
runnerPort: 9100
singleRun: true
# transpile CoffeeScript (.coffee) files to JavaScript (.js).
coffee:
build:
files: [
cwd: './src'
src: 'scripts/**/*.coffee'
dest: './temp/'
expand: true
ext: '.js'
]
options:
bare: true
#sourceMap: true
#prepend 'use strict' to the files
concat:
#usestrict:
options:
banner: "'use strict';\n"
process: (src, filepath) ->
console.log("Processing #{filepath} ...")
strings = /("(?:(?:\\")|[^"])*")/g
singleQuotes = /'/g
src.replace(strings,
(match) ->
console.log("match: " + match)
result = "'" + match.substring(1, match.length-1).replace(singleQuotes, "\\'") + "'"
console.log "replaced with: " + result
result
)
dynamic_mappings:
files:
'build/scripts/scroll.js': ['./temp/**/ui-scroll.js']
'build/scripts/scroll-jqlite.js': ['./temp/**/ui-scroll-jqlite.js']
# run the linter
jshint:
src:
files:
src: ['./build/**/*.js']
options: jshintrc: '.jshintrc'
test:
files:
src : [ './test/*Spec.js']
options: grunt.util._.extend({}, grunt.file.readJSON('.jshintrc'), {
node: true
globals:
angular: false
inject: false
jQuery: false
jasmine: false
afterEach: false
beforeEach: false
ddescribe: false
describe: false
expect: false
iit: false
it: false
spyOn: false
xdescribe: false
xit: false
})
# Starts a web server
# Enter the following command at the command line to execute this task:
# grunt server
grunt.registerTask 'server', [
'connect'
'watch'
]
grunt.registerTask 'default', ['server']
grunt.registerTask 'test', [
'karma:unit'
]
grunt.registerTask 'build', [
'jshint:test'
'karma:travis',
'coffee:build',
'concat',
'jshint:src']
grunt.registerTask 'travis', [
'karma:travis'
]