Skip to content

Commit 79dfe37

Browse files
authored
remove webpack comments from build (for yuidoc) (#377)
The comments in p5.sound.js are used to generate documentation in the p5.js repo as part of that project's yuidoc config. This removes the comments that webpack adds because they were confusing the YUIDoc parser. It also adds the version number and date to the top of both p5.sound.js and p5.sound.min.js
1 parent c02bc88 commit 79dfe37

File tree

4 files changed

+269
-27
lines changed

4 files changed

+269
-27
lines changed

Gruntfile.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ module.exports = function(grunt) {
44

55
grunt.initConfig({
66
pkg: grunt.file.readJSON('package.json'),
7-
7+
decomment: {
8+
any: {
9+
// remove comments added by webpack from the build
10+
files: {
11+
"./lib/p5.sound.js": "./lib/p5.sound.js",
12+
},
13+
options: {
14+
ignore: [
15+
// keep JSDoc comments (p5.js repo's YUIDoc task parses those for documentation)
16+
/\/\*\*\s*\n([^\*]|(\*(?!\/)))*\*\//g,
17+
// keep the version number
18+
/.*Version.*/
19+
]
20+
}
21+
}
22+
},
823
// Configure style consistency
924
eslint: {
1025
source: {
@@ -46,9 +61,10 @@ module.exports = function(grunt) {
4661
grunt.loadNpmTasks('grunt-eslint');
4762
grunt.loadNpmTasks('grunt-contrib-connect');
4863
grunt.loadNpmTasks('grunt-open');
64+
grunt.loadNpmTasks('grunt-decomment');
4965

5066
grunt.registerTask('lint', ['eslint:source']);
51-
grunt.registerTask('default', ['webpack:prod']);
67+
grunt.registerTask('default', ['webpack:prod', 'decomment']);
5268
grunt.registerTask('dev', ['connect','webpack:dev']);
5369
grunt.registerTask('serve', 'connect:server:keepalive');
5470
grunt.registerTask('run-tests', ['serve', 'open']);

0 commit comments

Comments
 (0)