Gulp browsersync-ssi 不工作
Gulp browsersync-ssi does not work
与 browsersync 一起,我正在 gulp 配置中处理 browsersync-ssi。
然而,它根本不起作用。请帮忙。
我的配置如下;
▼目录
├── app
│ ├── _stylus
│ │ └── main.styl
│ ├── img
│ ├── js
│ │ └── main.js
│ ├── ssi
│ │ └── include.html
│ └── index.ect
├── .tmp
│ └── dist
│ ├── css
│ │ └── main.css
│ └── index.html
├── gulp
│ ├── ...
│ ├── ...
│ ├── ...
│ ├── ...
│ ├── ...
│ └── browserSync.js
├── node_modules
├── bower_components
├── gulpfile.js
└── package.json
▼gulp/browserSybc.js
var gulp = require('gulp'),
browserSync = require('browser-sync'),
ssi = require('browsersync-ssi');
gulp.task('browser-sync', function() {
return browserSync({
notify: false,
logLevel: 'silence',
port: 9000,
ui: {
port: 9010
},
server: {
baseDir: ['.tmp/dist/', 'app/'],
routes: {'/bower_components': 'bower_components'},
middleware: [
ssi({
baseDir: __dirname + '/../app/ssi',
ext: '.html'
})
]
}
});
});
▼.tmp/dist/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SAMPLE</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="description" content="" />
<!-- build:css css/app.css -->
<!-- bower:css -->
<link rel="stylesheet" href="/bower_components/Materialize/bin/materialize.css" />
<!-- endbower -->
<!-- inject:css -->
<link rel="stylesheet" href="/css/main.css">
<!-- endinject -->
<!-- endbuild -->
<body>
<!--#include file="/include.html" -->
<div id="content">
......
当 gulp 运行时,ssi 描述保持原样,不包括 "include.html"。
什么是版本?
此来源有效。
var browserSync = require('browser-sync').create();
var ssi = require("browsersync-ssi");
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "./htdocs/",
middleware: [
ssi({
baseDir: __dirname + "/htdocs",
ext: ".html"
})
]
}
});
});
与 browsersync 一起,我正在 gulp 配置中处理 browsersync-ssi。
然而,它根本不起作用。请帮忙。
我的配置如下;
▼目录
├── app
│ ├── _stylus
│ │ └── main.styl
│ ├── img
│ ├── js
│ │ └── main.js
│ ├── ssi
│ │ └── include.html
│ └── index.ect
├── .tmp
│ └── dist
│ ├── css
│ │ └── main.css
│ └── index.html
├── gulp
│ ├── ...
│ ├── ...
│ ├── ...
│ ├── ...
│ ├── ...
│ └── browserSync.js
├── node_modules
├── bower_components
├── gulpfile.js
└── package.json
▼gulp/browserSybc.js
var gulp = require('gulp'),
browserSync = require('browser-sync'),
ssi = require('browsersync-ssi');
gulp.task('browser-sync', function() {
return browserSync({
notify: false,
logLevel: 'silence',
port: 9000,
ui: {
port: 9010
},
server: {
baseDir: ['.tmp/dist/', 'app/'],
routes: {'/bower_components': 'bower_components'},
middleware: [
ssi({
baseDir: __dirname + '/../app/ssi',
ext: '.html'
})
]
}
});
});
▼.tmp/dist/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SAMPLE</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="description" content="" />
<!-- build:css css/app.css -->
<!-- bower:css -->
<link rel="stylesheet" href="/bower_components/Materialize/bin/materialize.css" />
<!-- endbower -->
<!-- inject:css -->
<link rel="stylesheet" href="/css/main.css">
<!-- endinject -->
<!-- endbuild -->
<body>
<!--#include file="/include.html" -->
<div id="content">
......
当 gulp 运行时,ssi 描述保持原样,不包括 "include.html"。
什么是版本?
此来源有效。
var browserSync = require('browser-sync').create();
var ssi = require("browsersync-ssi");
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "./htdocs/",
middleware: [
ssi({
baseDir: __dirname + "/htdocs",
ext: ".html"
})
]
}
});
});