mdvorscak / metalsmith-browser-sync

A Metalsmith plugin to make your workflow easier.
MIT License
28 stars 12 forks source link

404 on file change. #9

Open Reklino opened 8 years ago

Reklino commented 8 years ago

On first run of my build.js file, everything works fine. Whenever I edit a file, .md or .jade, the browser reloads, but I get a 404 error. Has anyone else run into this issue?

build.js file:

var metalsmith = require('metalsmith'),
    layouts = require('metalsmith-layouts'),
    inPlace = require('metalsmith-in-place'),
    markdown = require('metalsmith-markdown'),
    browserSync = require('metalsmith-browser-sync'),
    moment = require('moment'),
    collections = require('metalsmith-collections'),
    beautify = require('metalsmith-beautify');

var siteBuild = metalsmith(__dirname)
    .metadata({
        site: {
            title: 'MetalSmith test'
        }
    })
    .source('./src')
    .destination('./build')
    .use(collections({
        posts: {
            pattern: 'posts/*.md',
            sortBy: 'date',
            reverse: true
        }
    }))
    .use(markdown())
    .use(layouts({
        engine: 'jade',
        moment: moment
    }))
    .use(browserSync({
        server : 'build',
        files  : ['src/**/*', 'layouts/*.jade']
    }))
    .build(function(err) {
        if(err) {
            console.log(err);
        }
        else {
            console.log('We did it!')
        }
    });
wdmtech commented 7 years ago

I also have this issue

roobie commented 7 years ago

Me too. But it's odd, because up until a bit ago, or so, it worked as expected. I have been doing a lot of changes in my build definition, so unfortunately, I can't really pinpoint when/where the issue manifested iteself.