This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Gruntfile.js
103 lines (102 loc) · 3.34 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
module.exports = function(grunt) {
// tasks
grunt.loadTasks('build/tasks');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-release');
// configuration
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/**\n' +
' * <%= pkg.description %>\n' +
' * @version v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
' */'
},
concat: {
dist: {
src: ['<banner:meta.banner>', 'src/ngx.js', 'src/deps/ecmascript/*.js', 'src/deps/head.js/*.js', 'src/modules/**/!(lang|test)/*.js', 'src/modules/**/lang/*.js'],
dest: 'dist/ngx.js'
}
},
clean: {
build: ['dist/']
},
copy: {
dist: {
files: [
{expand: true, cwd: 'src/modules/ui/', src: ['**/*.html'], dest: 'dist/templates/ui/' },
{expand: true, cwd: 'libs/', src: ['**'], dest: 'dist/libs'}
]
}
},
uglify: {
// Specify mangle: false to prevent changes to your variable and function names.
options: {
mangle: false
},
dist: {
files: {
'dist/ngx.min.js': ['dist/ngx.js']
}
}
},
recess: {
dist_css: {
src: 'src/**/*.less',
dest: 'dist/styles/ngx.css',
options: {
compile: true
}
},
dist_min: {
src: 'src/**/*.less',
dest: 'dist/styles/ngx.min.css',
options: {
compile: true,
compress: true
}
}
},
jshint: {
files: ['Gruntfile.js', 'src/ngx.js', 'src/modules/**/*.js']
},
watch: {
scripts: {
files: ['Gruntfile.js', 'src/*.js', 'src/**/*.js', 'test/**/*.js'],
tasks: ['lint', 'concat', 'min', 'karma']
},
styles: {
files: ['src/**/*.less'],
tasks: ['recess']
},
templates: {
files: ['src/modules/**/*.html'],
tasks: ['copy']
}
},
karma: {
unit: {
configFile: 'test/unit/config.js',
runnerPort: 9999,
singleRun: true,
browsers: ['PhantomJS']
}
},
release: {
options: {
npm: false //default: true
}
}
});
grunt.registerTask('default', ['jshint', 'clean', 'concat', 'copy', 'uglify', 'recess']);
grunt.registerTask('devel', ['karma', 'watch']);
};