forked from linkesch/medium-editor-insert-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
150 lines (138 loc) · 4.61 KB
/
Gruntfile.js
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('jit-grunt')(grunt, {
usebanner: 'grunt-banner'
});
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*! \n * <%= pkg.name %> v<%= pkg.version %> - <%= pkg.description %>\n *\n * <%= pkg.homepage %>\n * \n * Copyright (c) 2014 <%= pkg.author.name %> (<%= pkg.author.url %>)\n * Released under the <%= pkg.license %> license\n */\n\n',
concat: {
dist: {
options: {
banner: '<%= banner %>'
},
src: ['src/wrappers/start.js', 'src/js/templates.js', 'src/js/core.js', 'src/js/*.js', 'src/wrappers/end.js'],
dest: 'dist/js/<%= pkg.name %>.js'
}
},
uglify: {
dist: {
options: {
banner: '<%= banner %>'
},
src: ['dist/js/<%= pkg.name %>.js'],
dest: 'dist/js/<%= pkg.name %>.min.js'
}
},
jshint: {
options: {
jshintrc: true
},
files: ['src/js/*.js', '!src/js/templates.js', 'spec/*.js']
},
jasmine: {
suite: {
src: 'src/js/*.js',
options: {
specs: ['spec/*.spec.js'],
helpers: 'spec/helpers/*.js',
vendor: [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/medium-editor/dist/js/medium-editor.min.js',
'node_modules/handlebars/handlebars.runtime.min.js',
'node_modules/blueimp-file-upload/js/vendor/jquery.ui.widget.js',
'node_modules/blueimp-file-upload/js/jquery.iframe-transport.js',
'node_modules/blueimp-file-upload/js/jquery.fileupload.js'
],
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'reports/jasmine/coverage.json',
report: [{
type: 'lcov',
options: {
dir: 'reports/jasmine/lcov'
}
}]
},
summary: true
}
}
},
sass: {
options: {
implementation: require('node-sass')
},
dist: {
files: [{
expand: true,
cwd: 'src/sass/',
src: ['*.scss'],
dest: 'dist/css/',
ext: '.css'
}]
}
},
autoprefixer: {
dist: {
src: 'dist/css/*.css'
}
},
csso: {
dist: {
options: {
banner: '<%= banner %>'
},
expand: true,
cwd: 'dist/css/',
src: ['*.css', '!*.min.css'],
dest: 'dist/css/',
ext: '.min.css'
}
},
usebanner: {
dist: {
options: {
banner: '<%= banner %>',
linebreak: false
},
files: [{
expand: true,
cwd: 'dist/css/',
src: ['*.css', '!*.min.css'],
dest: 'dist/css/',
ext: '.css'
}]
}
},
watch: {
styles: {
files: 'src/sass/**/*.scss',
tasks: ['css'],
options: {
debounceDelay: 250
}
},
templates: {
files: 'src/js/templates/**/*.hbs',
tasks: ['handlebars'],
options: {
debounceDelay: 250
}
}
},
handlebars: {
compile: {
options: {
namespace: 'MediumInsert.Templates'
},
files: {
'src/js/templates.js': 'src/js/templates/*.hbs'
}
}
}
});
grunt.registerTask('test', ['jshint', 'jasmine']);
grunt.registerTask('js', ['handlebars', 'concat', 'uglify']);
grunt.registerTask('css', ['sass', 'autoprefixer', 'csso', 'usebanner']);
grunt.registerTask('default', ['js', 'css']);
};