Created
November 9, 2015 17:47
-
-
Save psyrendust/37844bd8e0f2dea0c8ea to your computer and use it in GitHub Desktop.
gulp build for esdoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// location: gulp/tasks/docs.js | |
const gulp = require('gulp'); | |
const esdoc = require('gulp-esdoc'); | |
const newer = require('gulp-newer'); | |
const plumber = require('gulp-plumber'); | |
const esdocJSON = require('../../esdoc.json'); | |
const logger = require('../util/logger'); | |
const esdocOptions = Object.assign({}, esdocJSON, { | |
destination: paths.docs, | |
source: null, | |
}); | |
gulp.task('docs', () => { | |
return gulp.src(paths.docsEntry) | |
.pipe(plumber()) | |
.pipe(newer(paths.docs)) | |
.pipe(esdoc(esdocOptions)); | |
}); | |
gulp.task('docs:watch', () => { | |
gulp.watch([paths.scripts, paths.manual, 'README.md'], ['docs']).on('change', evt => logger('Watching', evt, 'docs')); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"source": "./src/magellan", | |
"destination": "./dist/docs", | |
"access": ["public", "protected", "private"], | |
"debug": false, | |
"index": "./README.md", | |
"package": "./package.json", | |
"title": "Magellan", | |
"plugins": [ | |
{ | |
"name": "esdoc-es7-plugin" | |
}, | |
{ | |
"name": "esdoc-importpath-plugin", | |
"option": { | |
"replaces": [ | |
{ | |
"from": "^magellan/", | |
"to": "" | |
} | |
] | |
} | |
} | |
], | |
"manual": { | |
"overview": ["./manual/overview.md"], | |
"installation": ["./manual/installation.md"], | |
"usage": ["./manual/usage.md"], | |
"example": ["./manual/example.md"], | |
"faq": ["./manual/faq.md"], | |
"changelog": ["CHANGELOG.md"] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gulp = require('gulp'); | |
const path = require('path'); | |
const requireDir = require('require-dir'); | |
// Load in package.json | |
const pkg = require('./package.json'); | |
global.paths = { | |
src: './src', | |
out: './dist', | |
docs: './docs', | |
test: './test', | |
manual: './manual/*.md', | |
vendor: pkg.vendor.map(item => path.join('node_modules', item)), | |
get docsEntry() { return `${this.src}/magellan`; }, | |
get jsEntry() { return `${this.src}/magellan/index`; }, | |
get scripts() { return `${this.src}/magellan/**/*.js`; }, | |
get sass() { return `${this.src}/scss/**/*.scss`; }, | |
get sassEntry() { return `${this.src}/scss/index.scss`; }, | |
get vendorOut() { return `${this.out}/vendor`; }, | |
}; | |
// Load in all modular gulp tasks | |
requireDir('./gulp/tasks', { recurse: true }); | |
gulp.task('default', ['lint', 'build']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// location: gulp/util/logger.js | |
const gutil = require('gulp-util'); | |
const path = require('path'); | |
module.exports = function logger(prefix, evt, task) { | |
gutil.log(`${prefix} '${gutil.colors.cyan(`file ${evt.type}`)}' ${path.relative(path.dirname(__dirname), evt.path)} ${gutil.colors.magenta(`running '${task}'...`)}`); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment