Skip to content

Instantly share code, notes, and snippets.

@anuraaga
Last active August 22, 2016 10:04
Show Gist options
  • Save anuraaga/b25cde3f08675ced5f567fe290de5838 to your computer and use it in GitHub Desktop.
Save anuraaga/b25cde3f08675ced5f567fe290de5838 to your computer and use it in GitHub Desktop.
Gulp config for serving a static directory with clean URLs.
"use strict";
var gulp = require('gulp')
, modRewrite = require('connect-modrewrite')
, connect = require('gulp-connect');
gulp.task('connect', function () {
connect.server({
name: 'Test',
root: ['dist'],
port: 8080,
middleware: function () {
return [
modRewrite([
'^/$ /index.html [L]',
'^/static/.* - [L]',
'^(.*)$ $1.html'
])
]
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment