|
|
@@ -21,7 +21,7 @@ const DEFAULT_LANGUAGE = 'en';
|
|
|
* @param {Set.<Snippet>} snippets Snippet collection extracted from documentation files.
|
|
|
* @param {Object} options
|
|
|
* @param {Boolean} options.production Whether to build snippets in production mode.
|
|
|
- * @param {Array.<String>>} options.whitelistedSnippets An array that contains glob patterns
|
|
|
+ * @param {Array.<String>>|undefined} options.whitelistedSnippets An array that contains glob patterns.
|
|
|
* @param {Object.<String, Function>} umbertoHelpers
|
|
|
* @returns {Promise}
|
|
|
*/
|
|
|
@@ -75,7 +75,9 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) {
|
|
|
}
|
|
|
|
|
|
// Remove snippets that do not match to patterns specified in `options.whitelistedSnippets`.
|
|
|
- filterWhitelistedSnippets( snippets, options.whitelistedSnippets );
|
|
|
+ if ( options.whitelistedSnippets ) {
|
|
|
+ filterWhitelistedSnippets( snippets, options.whitelistedSnippets );
|
|
|
+ }
|
|
|
|
|
|
console.log( 'Number of snippets that will be built:', snippets.size );
|
|
|
|
|
|
@@ -139,7 +141,7 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) {
|
|
|
// CSS may not be generated by Webpack if a snippet's JS file didn't import any CSS files.
|
|
|
const wasCSSGenerated = fs.existsSync( path.join( snippetData.outputPath, snippetData.snippetName, 'snippet.css' ) );
|
|
|
|
|
|
- // If the snippet is a dependency, append JS and CSS to HTML save to disk and continue.
|
|
|
+ // If the snippet is a dependency, append JS and CSS to HTML, save to disk and continue.
|
|
|
if ( snippetData.requiredFor ) {
|
|
|
let htmlFile = fs.readFileSync( snippetData.snippetSources.html ).toString();
|
|
|
|
|
|
@@ -194,7 +196,7 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) {
|
|
|
* Removes snippets that names do not match to patterns specified in `whitelistedSnippets` array.
|
|
|
*
|
|
|
* @param {Set.<Snippet>} snippets Snippet collection extracted from documentation files.
|
|
|
- * @param {Array.<String>} whitelistedSnippets Snippet patterns that should be built.
|
|
|
+ * @param {Array.<String>|undefined} whitelistedSnippets Snippet patterns that should be built.
|
|
|
*/
|
|
|
function filterWhitelistedSnippets( snippets, whitelistedSnippets ) {
|
|
|
if ( !whitelistedSnippets.length ) {
|