在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):avevlad/gulp-connect开源软件地址(OpenSource Url):https://github.com/avevlad/gulp-connect开源编程语言(OpenSource Language):CoffeeScript 47.7%开源软件介绍(OpenSource Introduction):gulp-connect
Sponsorsgulp-connect is sponsored by JetBrains! Install
Usagevar gulp = require('gulp');
var connect = require('gulp-connect');
gulp.task('connect', function() {
connect.server();
});
gulp.task('default', ['connect']); LiveReloadvar gulp = require('gulp');
var connect = require('gulp-connect');
gulp.task('connect', function() {
connect.server({
root: 'app',
livereload: true
});
});
gulp.task('html', function () {
gulp.src('./app/*.html')
.pipe(gulp.dest('./app'))
.pipe(connect.reload());
});
gulp.task('watch', function () {
gulp.watch(['./app/*.html'], ['html']);
});
gulp.task('default', ['connect', 'watch']); Start and stop servergulp.task('jenkins-tests', function() {
connect.server({
port: 8888
});
// run some headless tests with phantomjs
// when process exits:
connect.serverClose();
}); Multiple servervar gulp = require('gulp');
var connect = require('gulp-connect');
var stylus = require('gulp-stylus');
gulp.task('connectDev', function () {
connect.server({
name: 'Dev App',
root: ['app', 'tmp'],
port: 8000,
livereload: true
});
});
gulp.task('connectDist', function () {
connect.server({
name: 'Dist App',
root: 'dist',
port: 8001,
livereload: true
});
});
gulp.task('html', function () {
gulp.src('./app/*.html')
.pipe(gulp.dest('./app'))
.pipe(connect.reload());
});
gulp.task('stylus', function () {
gulp.src('./app/stylus/*.styl')
.pipe(stylus())
.pipe(gulp.dest('./app/css'))
.pipe(connect.reload());
});
gulp.task('watch', function () {
gulp.watch(['./app/*.html'], ['html']);
gulp.watch(['./app/stylus/*.styl'], ['stylus']);
});
gulp.task('default', ['connectDist', 'connectDev', 'watch']); http2 supportIf the http2 package is installed and you use an https connection to gulp connect then http 2 will be used in preference to http 1. APIoptions.rootType: The root path options.portType: The connect webserver port options.hostType: options.nameType: The name that will be output when the server starts/stops. options.httpsType: Can be any options documented at https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener When https is just set to options.livereloadType: options.livereload.portType: Overrides the hostname of the script livereload injects in index.html options.livereload.hostnameType: options.fallbackType: Fallback file (e.g. options.middlewareType: options.debugType: options.indexType: gulp.task('connect', function() {
connect.server({
root: "app",
middleware: function(connect, opt) {
return [
// ...
]
}
});
}); ContributingTo contribute to this project, you must have CoffeeScript installed: Then, to build the Contributors |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论