-
Notifications
You must be signed in to change notification settings - Fork 121
/
Gruntfile.js
39 lines (36 loc) · 1.56 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
ghosthunter_embedded_lunr: {
src: "src/<%= pkg.name %>.js",
dest: "dist/jquery.ghosthunter.js",
options: {
process: function(content, path) {
var lunr = grunt.file.read('./src/lunr.js');
content = content.replace(/\/\*\s+lunr\s+\*\//i, lunr);
var levenshtein = grunt.file.read('./src/levenshtein.js');
content = content.replace(/\/\*\s+levenshtein\s+\*\//i, levenshtein);
return grunt.template.process(content)
}
}
},
ghosthunter_required_lunr: {
src: "src/<%= pkg.name %>.js",
dest: "dist/jquery.ghosthunter-use-require.js",
options: {
process: function(content, path) {
content = content.replace(/\/\*\s+lunr\s+\*\//i, 'var lunr = require("lunr")');
var levenshtein = grunt.file.read('./src/levenshtein.js');
content = content.replace(/\/\*\s+levenshtein\s+\*\//i, levenshtein);
return grunt.template.process(content)
}
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task(s).
grunt.registerTask('default', ['copy']);
};