Skip to content

Commit

Permalink
remove webpack comments from build (for yuidoc) (processing#377)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
therewasaguy authored Sep 4, 2019
1 parent c02bc88 commit 79dfe37
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 27 deletions.
20 changes: 18 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

decomment: {
any: {
// remove comments added by webpack from the build
files: {
"./lib/p5.sound.js": "./lib/p5.sound.js",
},
options: {
ignore: [
// keep JSDoc comments (p5.js repo's YUIDoc task parses those for documentation)
/\/\*\*\s*\n([^\*]|(\*(?!\/)))*\*\//g,
// keep the version number
/.*Version.*/
]
}
}
},
// Configure style consistency
eslint: {
source: {
Expand Down Expand Up @@ -46,9 +61,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-decomment');

grunt.registerTask('lint', ['eslint:source']);
grunt.registerTask('default', ['webpack:prod']);
grunt.registerTask('default', ['webpack:prod', 'decomment']);
grunt.registerTask('dev', ['connect','webpack:dev']);
grunt.registerTask('serve', 'connect:server:keepalive');
grunt.registerTask('run-tests', ['serve', 'open']);
Expand Down
Loading

0 comments on commit 79dfe37

Please sign in to comment.