-
Notifications
You must be signed in to change notification settings - Fork 35
/
Gruntfile.js
72 lines (66 loc) · 2.03 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
module.exports = function (grunt) {
'use strict'
if (!grunt.option('filename')) {
grunt.option('filename', 'jsmart.js')
}
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
build: {
all: {
dest: "dist/<%= grunt.option('filename') %>"
}
},
eslint: {
src: ['src/**/*.js', 'Gruntfile.js', 'karma.conf.js', 'test/**/*.js', 'build/*.js']
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
uglify: {
all: {
options: {
preserveComments: false,
sourceMap: false,
report: 'min',
banner: '/*!\n' +
' * jSmart JavaScript template engine (v<%= pkg.version %>)\n' +
' * https://github.com/umakantp/jsmart\n' +
' * https://opensource.org/licenses/MIT\n' +
' *\n' +
' * Copyright 2011-2021, Umakant Patil <me at umakantpatil dot com>\n' +
' * Max Miroshnikov <miroshnikov at gmail dot com>\n' +
' */\n'
},
files: {
"dist/<%= grunt.option('filename').replace('.js', '.min.js') %>": ["dist/<%= grunt.option('filename') %>"]
}
}
},
copy: {
main: {
files: [
{
src: "dist/<%= grunt.option('filename').replace('.js', '.min.js') %>",
dest: 'examples/simple/<%= pkg.name %>.min.js'
},
{
src: "dist/<%= grunt.option('filename').replace('.js', '.min.js') %>",
dest: 'examples/requirejs/js/<%= pkg.name %>.min.js'
}
]
}
}
})
// Load grunt tasks from NPM packages
require('load-grunt-tasks')(grunt)
// Integrate jSmart specific tasks
grunt.loadTasks('build/tasks')
// Register tasks from karma, uglify and copy.
grunt.loadNpmTasks('grunt-karma')
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-copy')
// Order goes as test, compile, compress and distribute.
grunt.registerTask('default', ['eslint', 'karma', 'build', 'uglify', 'copy'])
}