When running command jekyll serve --no-watch .
to run a server for testing, whenever I make changes to “test.txt” and refresh the page, the changes are not captured (for example, when “hello” is in test.txt and I erase the text and refresh the page, “hello” is still present). Is there a way to reverse this behavior? I understand that --no-watch
means the site won’t automatically regenerate when files change, however, my understanding is that it should still serve the files correctly when manually refreshing the page. Code snippet below:
<script>
function bannerUpdate() {
const url = 'http://127.0.0.1:4000/test.txt'
let bannerText = ''
let bannerInit = {
method: 'GET',
cache: 'no-cache',
};
fetch(url, bannerInit)
.then(response => {
response.text().then(text => {
bannerText = text;
console.log("banner text is: "+bannerText);
done();
});
});
function done() {
banner.textContent = bannerText;
if (bannerText.trim() !== '') {
banner.style.backgroundColor = '#fff691';
banner.textContent = bannerText;
banner.style.display = 'block';
}
}
}
window.onload = bannerUpdate;
</script>