B
B
BludFIRE2020-12-03 15:12:30
gulp.js
BludFIRE, 2020-12-03 15:12:30

How to fix this galp build?

I'm trying to write the correct gulpfile, but I can't write cannot get in the browser.
Gulp 4.0.2
All packages via npma added as DevDependency

var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');

gulp.task('sass', function(done) {
    gulp.src("assets/css/scss/*.scss")
        .pipe(sass())
        .pipe(gulp.dest("assets/css/css"))
        .pipe(browserSync.stream());


    done();
});

gulp.task('serve', function(done) {

    browserSync.init({
        server: "homepage.html"
    });

    gulp.watch("src/sass/*.sass", gulp.series('sass'));
    gulp.watch("src/*.html").on('change', () => {
      browserSync.reload();
      done();
    });
  

    done();
});

gulp.task('default', gulp.series('sass', 'serve'));


All I have to do is compile the sass code to css, File structure:

assets>> css >> scss(folder where the sass code is to be compiled) , main.css(sass should be compiled into this file)

node_modules

gulpfile.js
index.html
package.json

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
ilonikso, 2020-12-03
@ilonikso

You need to install gulp globally

S
Sergey delphinpro, 2020-12-03
@delphinpro

you can go and read the browserSync documentation.
Specify a folder with html files for the server, and allow it to show a directory listing.
https://browsersync.io/docs/options#option-server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question