UNPKG

2.18 kBJavaScriptView Raw
1var fs = require('fs');
2
3module.exports = function(grunt) {
4
5 var minifiedFiles = {
6 'min/numeral.min.js' : [
7 'numeral.js'
8 ],
9 'min/languages.min.js': [
10 'languages.js'
11 ]
12 };
13
14 // all the lang files need to be added manually
15 fs.readdirSync('./languages').forEach(function (path) {
16 var file = path.slice(0, -3),
17 destination = 'min/languages/' + file + '.min.js',
18 src = ['languages/' + path];
19
20 minifiedFiles[destination] = src;
21 });
22
23 grunt.initConfig({
24 nodeunit : {
25 all : ['tests/**/*.js']
26 },
27 uglify: {
28 my_target: {
29 files: minifiedFiles
30 },
31 options: {
32 preserveComments: 'some'
33 }
34 },
35 concat: {
36 languages: {
37 src: [
38 'languages/**/*.js'
39 ],
40 dest: 'languages.js'
41 }
42 },
43 jshint: {
44 all: [
45 'Gruntfile.js',
46 'numeral.js',
47 'languages/**/*.js'
48 ],
49 options: {
50 'node': true,
51 'browser': true,
52 'curly': true,
53 'devel': false,
54 'eqeqeq': true,
55 'eqnull': true,
56 'newcap': true,
57 'noarg': true,
58 'onevar': true,
59 'undef': true,
60 'sub': true,
61 'strict': false,
62 'quotmark': 'single'
63 }
64 }
65 });
66
67 grunt.loadNpmTasks('grunt-contrib-nodeunit');
68 grunt.loadNpmTasks('grunt-contrib-uglify');
69 grunt.loadNpmTasks('grunt-contrib-jshint');
70 grunt.loadNpmTasks('grunt-contrib-concat');
71
72 grunt.registerTask('default', [
73 'test'
74 ]);
75
76 grunt.registerTask('test', [
77 'jshint',
78 'nodeunit'
79 ]);
80
81 // P
82 grunt.registerTask('build', [
83 'jshint',
84 'nodeunit',
85 'concat',
86 'uglify'
87 ]);
88
89 // Travis CI task.
90 grunt.registerTask('travis', ['test']);
91};
\No newline at end of file