Просмотр исходного кода

Merge pull request #2819 from overleaf/jpa-sk-improve-pug-precompile

[misc] improve pug precompile

GitOrigin-RevId: 2eaa9be3f04c2639ca3b2fce4b36f42972622124
Simon Detheridge 6 лет назад
Родитель
Сommit
4c88a83332
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      services/web/app/src/infrastructure/Views.js

+ 10 - 4
services/web/app/src/infrastructure/Views.js

@@ -5,12 +5,18 @@ const globby = require('globby')
 // Generate list of view names from app/views
 
 const viewList = globby
-  .sync('**/*.pug', {
+  .sync('app/views/**/*.pug', {
     onlyFiles: true,
     concurrency: 1,
-    ignore: '**/_*.pug',
-    cwd: 'app/views'
+    ignore: '**/_*.pug'
   })
+  .concat(
+    globby.sync('modules/*/app/views/**/*.pug', {
+      onlyFiles: true,
+      concurrency: 1,
+      ignore: '**/_*.pug'
+    })
+  )
   .map(x => {
     return x.replace(/\.pug$/, '') // strip trailing .pug extension
   })
@@ -25,7 +31,7 @@ module.exports = {
     let failures = 0
     viewList.forEach(view => {
       try {
-        let filename = app.get('views') + '/' + view + '.pug'
+        let filename = view + '.pug'
         pug.compileFile(filename, { cache: true })
         logger.log({ view }, 'compiled')
         success++