mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +00:00
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
var timing = require('../utils/timing');
|
|
|
|
/**
|
|
List all assets in a book
|
|
Assets are file not ignored and not a page
|
|
|
|
@param {Book} book
|
|
@param {List<String>} pages
|
|
@param
|
|
*/
|
|
function listAssets(book, pages) {
|
|
var fs = book.getContentFS();
|
|
|
|
var summary = book.getSummary();
|
|
var summaryFile = summary.getFile().getPath();
|
|
|
|
var glossary = book.getGlossary();
|
|
var glossaryFile = glossary.getFile().getPath();
|
|
|
|
var langs = book.getLanguages();
|
|
var langsFile = langs.getFile().getPath();
|
|
|
|
var config = book.getConfig();
|
|
var configFile = config.getFile().getPath();
|
|
|
|
function filterFile(file) {
|
|
return !(
|
|
file === summaryFile ||
|
|
file === glossaryFile ||
|
|
file === langsFile ||
|
|
file === configFile ||
|
|
book.isContentFileIgnored(file) ||
|
|
pages.has(file)
|
|
);
|
|
}
|
|
|
|
return timing.measure(
|
|
'parse.listAssets',
|
|
fs.listAllFiles('.', filterFile)
|
|
);
|
|
}
|
|
|
|
module.exports = listAssets;
|