J
J
Juniorr2016-07-25 15:06:22
Node.js
Juniorr, 2016-07-25 15:06:22

Gulp keeps crashing?

Gulp constantly crashes, although it starts up, it worked clearly. The server starts, no errors, but there is no connection to the server. Accordingly, there is no compilation. The browser cannot access the site ( locallhost.com/.)
The localhost site does not allow a connection to be established.
Perhaps you meant locallhost.com/.
Search Google for localhost
ERR_CONNECTION_REFUSED
Running 'default'...
[15:00:31] Using gulpfile F:\work\jd_5\jd-5\start_html-master\gulpfile.js
[15:00:31] Starting 'styles'...
[15:00:31] Finished 'styles' after 16 ms
[15:00:31] Starting 'express'...
[15:00:31] Finished 'express' after 98 ms
[15:00:31] Starting 'livereload'...
[15:00:31] Finished 'livereload' after 69 ms
[15:00:31] Starting 'watch'...
[15:00:31] Finished 'watch' after 18 ms
[15:00:31] Starting 'default'...
[15:00:31] Finished 'default' after 5.99 μs

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Juniorr, 2016-07-25
@Juniorr

global.hostname = "localhost";
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require(' gulp-rename');
gulp.task('express', function() {
var express = require('express');
var app = express();
app.use(require('connect-livereload')({port: 35729}));
app.use(express.static(__dirname + '/app'));
app.listen('80', hostname);
});
var tinylr;
gulp.task('livereload', function() {
tinylr = require('tiny-lr')();
tinylr.listen(35729);
});
var fileName = require('path').relative(__dirname, event.path);
tinylr.changed({
body: {
files: [fileName]
}
});
}
gulp.task('styles', function () {
gulp.src('sass/*.sass')
.pipe(sass({
includePaths: require('node-bourbon').includePaths
}).on('error ', sass.logError))
.pipe(rename({suffix: '.min', prefix : '_'}))
.pipe(autoprefixer({
browsers: ['last 15 versions'],
cascade: false
}))
.pipe(minifycss())
.pipe(gulp.dest('app'));
});
gulp.task('watch', function() {
gulp.watch('sass/*.sass',
gulp.watch('app/*.css', notifyLiveReload);
gulp.watch('app/*.html', notifyLiveReload);
});
gulp.task('default', ['styles', 'express', 'livereload', 'watch'], function() {
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question