This repository was archived by the owner on Feb 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGruntfile.js
More file actions
54 lines (43 loc) · 1.42 KB
/
Gruntfile.js
File metadata and controls
54 lines (43 loc) · 1.42 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
var fs = require('fs');
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['Gruntfile.js', '<%= pkg.name %>/*.js', 'public/js/*.js',
'!public/js/*.min.js'],
},
cssmin: {
files: {
src: 'public/css/<%= pkg.name %>.css',
dest: 'public/css/<%= pkg.name %>.min.css'
}
},
uglify: {
build: {
src: 'public/js/<%= pkg.name %>.js',
dest: 'public/js/<%= pkg.name %>.min.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', 'jshint');
grunt.registerTask('postinstall', ['cssmin', 'uglify']);
grunt.registerTask('words', 'Generate word list', function() {
var words = [];
['american-english', 'british-english'].forEach(function(dict) {
var data = fs.readFileSync('/usr/share/dict/' + dict,
{encoding: 'utf8'});
data.trim().split('\n').forEach(function(word) {
if (/^[a-z]{3,}$/.test(word)) {
if (/s$/.test(word) && words.indexOf(word.slice(0, -1)) != -1);
else if (words.indexOf(word) == -1)
words.push(word);
}
});
});
fs.writeFileSync('data/words', words.sort().join('\n'));
grunt.log.writeln(words.length + ' words');
});
};