Last active
July 11, 2020 13:30
-
-
Save Na0ki/15088e7b80e7a51d114d4f934de0eb1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const browserSync = require('browser-sync').create(); | |
const asciidoctor = require('@asciidoctor/core')(); | |
const asciidoctorReveiljs = require('@asciidoctor/reveal.js'); | |
asciidoctorReveiljs.register(); | |
browserSync.watch('*.adoc', function(event, file) { | |
if (event === 'change') { | |
console.log(`${file} changed. start converting...`); | |
asciidoctor.convertFile('index.adoc', {safe: 'safe', backend: 'revealjs'}); | |
console.log(`reloading`); | |
browserSync.reload('index.html'); | |
} | |
}); | |
browserSync.init({ | |
server: './', | |
localOnly: true, | |
open: 'local', | |
ui: false, | |
}, function(err, _) { | |
if (err) { | |
console.error(err); | |
return; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment