// Dependencies // ============================================================================= const browserSync = require('browser-sync').create(); const compression = require('compression'); browserSync.init({ files: [ './dist/**/*.*', './docs/**/*.*' ], ghostMode: { clicks: false, forms : false, scroll: false }, open: false, notify: false, cors: true, reloadDebounce: 1000, reloadOnRestart: true, server: { baseDir: [ './docs/' ], middleware: [ compression() ] }, serveStatic: [ './dist/' ], snippetOptions: { rule: { match: /<\/body>/i, fn: function (snippet, match) { // Fix CSS injection for alternate stylesheets const styleSwitchFix = ` `; return snippet + styleSwitchFix + match; } } }, rewriteRules: [ { // Replace CDN default with local js path match : /"https:\/\/unpkg\.com\/docsify-themeable"/g, replace: '"/js/docsify-themeable.min.js"' }, { // Replace CDN URLs with local paths match : /https:\/\/unpkg\.com\/docsify-themeable\/dist\//g, replace: '/' } ] });