forked from pm2-hive/pm2-hive.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
54 lines (46 loc) · 1.13 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
// From module strip-yaml-header
var pattern = pattern = '^(' +
'((= yaml =)|(---))' +
'$([\\s\\S]*?)' +
'\\2' +
'$' +
(process.platform === 'win32' ? '\\r?' : '') +
'(?:\\n)?)';
var yamlRegexp = new RegExp(pattern, 'm');
function replaceByBr(text) {
return text.replace(yamlRegexp, function (all) {
var lines = all.split("\n");
return (new Array(lines.length)).join("");
});
}
function normalize(markdown) {
if (yamlRegexp.test(markdown)) {
return replaceByBr(markdown);
}
return markdown;
}
module.exports = function(grunt) {
var i = 0;
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
stripBanners: true,
process: function(src, filepath) {
i++;
if (i == 1) { return src;}
return normalize(src);
}
},
dist: {
src: ['docs/intro.md',
'docs/features/*'],
dest: 'docs/full.md'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
// Default task(s).
grunt.registerTask('default', ['concat']);
};