Last active
January 5, 2017 20:42
-
-
Save joemaller/0254b34b88cfc6a9a665025c722891b5 to your computer and use it in GitHub Desktop.
Example gulpfile showing how to serve Browsersync from an arbitrary subpath. Download the zip, `npm install` and `gulp watch`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var browsersync = require('browser-sync').create(); | |
gulp.task('watch', function() { | |
browsersync.init({ | |
files: './*.html', | |
startPath: '/some/multi/level/path', | |
server: { | |
baseDir: '-', | |
routes: { | |
'/some/multi/level/path': '.' | |
} | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Example gulpfile</title> | |
</head> | |
<body> | |
<a href="http://stackoverflow.com/questions/30370753/gulp-browsersync-serve-at-path">Gulp + BrowserSync, serve at path</a><br> | |
<a href="https://github.com/BrowserSync/browser-sync/issues/1224">Is there a way to mount the application in a sub path? #1224</a> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "so-test", | |
"version": "0.0.0", | |
"private": true, | |
"author": "Joe Maller <joe@joemaller.com> (https://github.com/joemaller)", | |
"license": "ISC", | |
"devDependencies": { | |
"browser-sync": "^2.18.5", | |
"gulp": "^3.9.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment