mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #2819 from overleaf/jpa-sk-improve-pug-precompile
[misc] improve pug precompile GitOrigin-RevId: 2eaa9be3f04c2639ca3b2fce4b36f42972622124
This commit is contained in:
parent
2a8e2efe62
commit
4c88a83332
1 changed files with 10 additions and 4 deletions
|
@ -5,12 +5,18 @@ const globby = require('globby')
|
||||||
// Generate list of view names from app/views
|
// Generate list of view names from app/views
|
||||||
|
|
||||||
const viewList = globby
|
const viewList = globby
|
||||||
.sync('**/*.pug', {
|
.sync('app/views/**/*.pug', {
|
||||||
onlyFiles: true,
|
onlyFiles: true,
|
||||||
concurrency: 1,
|
concurrency: 1,
|
||||||
ignore: '**/_*.pug',
|
ignore: '**/_*.pug'
|
||||||
cwd: 'app/views'
|
|
||||||
})
|
})
|
||||||
|
.concat(
|
||||||
|
globby.sync('modules/*/app/views/**/*.pug', {
|
||||||
|
onlyFiles: true,
|
||||||
|
concurrency: 1,
|
||||||
|
ignore: '**/_*.pug'
|
||||||
|
})
|
||||||
|
)
|
||||||
.map(x => {
|
.map(x => {
|
||||||
return x.replace(/\.pug$/, '') // strip trailing .pug extension
|
return x.replace(/\.pug$/, '') // strip trailing .pug extension
|
||||||
})
|
})
|
||||||
|
@ -25,7 +31,7 @@ module.exports = {
|
||||||
let failures = 0
|
let failures = 0
|
||||||
viewList.forEach(view => {
|
viewList.forEach(view => {
|
||||||
try {
|
try {
|
||||||
let filename = app.get('views') + '/' + view + '.pug'
|
let filename = view + '.pug'
|
||||||
pug.compileFile(filename, { cache: true })
|
pug.compileFile(filename, { cache: true })
|
||||||
logger.log({ view }, 'compiled')
|
logger.log({ view }, 'compiled')
|
||||||
success++
|
success++
|
||||||
|
|
Loading…
Reference in a new issue