A
A
Anna2017-04-17 21:32:44
gulp.js
Anna, 2017-04-17 21:32:44

Browser sync error?

set up project build using gulp. when checking, everything seemed to work until it came to loading images. when opening index.html in safari, pictures are not available. if you try to open them in a new tab, it says "Cannot GET /app/img/logo.png". Chrome doesn't have this problem. what could be wrong and how to fix it?
code snippets below.

var gulp          = require('gulp'),
      browserSync = require('browser-sync');


gulp.task('browser-sync', function() { 
    browserSync({
        server: { 
            baseDir: 'app' 
        },
        notify: false 
    });
});


gulp.task('watch', ['browser-sync', 'sass', 'scripts'], function() {
    gulp.watch('app/sass/**/*.scss', ['sass']); 
    gulp.watch('app/*.html', browserSync.reload); 
    gulp.watch('app/js/**/*.js', browserSync.reload); 
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2017-04-17
@anndarina

baseDir: 'app'
app/ - you have a document root for the server,
so you need to specify the path to the pictures like this /img/logo.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question