2
저는 프로그램에 약간의 문제가 있습니다. 특히 브라우저 동기화 때문입니다. 내 프로젝트에서 BrowserSync를 제거하고 싶습니다.덤프를 위해 server.js에서 browsersync를 제거하십시오
여기에 내 현재 꿀꺽/server.js
'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var browserSync = require('browser-sync');
var browserSyncSpa = require('browser-sync-spa');
var util = require('util');
var proxyMiddleware = require('http-proxy-middleware');
function browserSyncInit(baseDir, browser)
{
browser = browser === undefined ? 'default' : browser;
var routes = null;
if (baseDir === conf.paths.src || (util.isArray(baseDir) && baseDir.indexOf(conf.paths.src) !== -1))
{
routes = {
'/bower_components': 'bower_components'
};
}
var server = {
baseDir: baseDir,
routes : routes
};
/*
* You can add a proxy to your backend by uncommenting the line below.
* You just have to configure a context which will we redirected and the target url.
* Example: $http.get('/users') requests will be automatically proxified.
*
* For more details and option, https://github.com/chimurai/http-proxy-middleware/blob/v0.9.0/README.md
*/
// server.middleware = proxyMiddleware('/users', {target: 'http://jsonplaceholder.typicode.com', changeOrigin: true});
browserSync.instance = browserSync.init({
startPath: '/',
server : server,
ghostMode : false,
browser : browser
});
}
browserSync.use(browserSyncSpa({
selector: '[ng-app]'// Only needed for angular apps
}));
gulp.task('serve', ['watch'], function()
{
browserSyncInit([path.join(conf.paths.tmp, '/serve'), conf.paths.src]);
});
gulp.task('serve:dist', ['build'], function()
{
browserSyncInit(conf.paths.dist);
});
gulp.task('serve:e2e', ['inject'], function()
{
browserSyncInit([conf.paths.tmp + '/serve', conf.paths.src], []);
});
gulp.task('serve:e2e-dist', ['build'], function()
{
browserSyncInit(conf.paths.dist, []);
});
그리고 내 현재 gulpfiles.js의
/**
* Welcome to your gulpfile!
* The gulp tasks are splitted in several files in the gulp directory
* because putting all here was really too long
*/
'use strict';
var gulp = require('gulp');
var wrench = require('wrench');
/**
* This will load all js or coffee files in the gulp directory
* in order to load all gulp tasks
*/
wrench.readdirSyncRecursive('./gulp').filter(function(file) {
return (/\.(js|coffee)$/i).test(file);
}).map(function(file) {
require('./gulp/' + file);
});
/**
* Default task clean temporaries directories and launch the
* main optimization build task
*/
gulp.task('default', ['clean'], function() {
gulp.start('build');
});
나는 브라우저 동기화가 설치되지 않은 서버에서 서로 다른 파일 그래서 '를 다운로드 browserSyncInit을 거치지 않고 내 다른 gulp.task를 시작하거나 BrowserSync 및 BrowserSyncSpa에 대한 호출이없는 browserSyncInit이 있어야합니다.
는 (나는 내가 BrowserSync에 대한 호출을 제거한 내 꿀꺽 폴더에 다른은 .js를 가지고 있고이 파일에 아무런 문제가 없음을 지정합니다.)