Skip to content

Commit

Permalink
chore(doc.build): dont re-build md when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4x committed Jun 7, 2017
1 parent 2c080d1 commit 9ed3353
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions docgen/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,13 @@ watch([
.on('all', (event, filePath) => {
// filter out plugins we dont need on some files changes
// example: remove `documentationjs` when no src/ files changed.
const isSrcFileChange = event === 'change'
&& filePath.includes('src/')
&& !filePath.includes('docgen')

const isSassFile = event === 'change'
&& filePath.includes('docgen')
&& /^[^_.].*\.s[ac]ss/.test(filePath)
const isSrcFileChange = filePath.includes('src/') && !filePath.includes('docgen')
const isSassFile = filePath.includes('docgen') && /^[^_.].*\.s[ac]ss/.test(filePath)
const isMarkdownFile = filePath.includes('docgen') && /\.md$/.test(filePath)

const nextMiddlewares = middlewares
.filter(fn =>
!isSrcFileChange && fn.name !== 'documentationjs'
)
.filter(fn => !isSrcFileChange && fn.name !== 'documentationjs')
.filter(fn => !isMarkdownFile && fn.name !== 'markdown')
.filter(fn =>
!isSassFile && (fn.name === 'bound compileSass' || fn.name === 'sassAutoprefixer')
? false
Expand Down

0 comments on commit 9ed3353

Please sign in to comment.