johnpapa / johnpapa/lite-server
Grunt BrowserSync With Lite-Server
- Dominant language
- JavaScript
- Stars
- 2.3k
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
### Expected Outcome
lite-server is able to handle routing requests from Angular 1 where the routing scheme is /page. lite-server is able to use the browserSync configuration already set in my Gruntfile.js to port number, file directory, etc.
### Problem
Documentation does not clarify the setup that the user should have in order to use site-server. The readme says that you can use site-server on top of browsersync to handle Angular requests but does this mean that you must first start an instance of BrowserSync? What does it mean that lite-server is a wraper for BrowserSync? Can lite-server be used with Grunt/Gulp or is this only to be used with NPM?
In Browser-sync the pages can be requested if a routing scheme is added such as /:param, however, Browser-sync fails when a specific request is called such as /page, hence the installation of lite-server. After reading the documentation and installing lite-server globally and creating a new config file, regardless of the port number added the server still runs on localhost:3000 even though my grunt browser-sync file specifies a port of 9005. This gives me the impression that lite-server should only be used independtly from Browser-Sync and cannot be coupled.
### BrowserSync Config
browserSync: {
options: {
notify: false,
background: true,
watchOptions: {
ignored: ''
}
},
livereload: {
options: {
files: [
'<%= config.app %>/{,*/}*.html',
'<%= config.app %>/{,*/}/{,*/}/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= config.app %>/images/{,*/}*',
'.tmp/scripts/{,*/}*.js',
'/pages/faq/{,*/}*.html'
],
port: 9005,
server: {
baseDir: ['.tmp', config.app],
routes: {
'/bower_components': './bower_components'
}
}
}
},
dist: {
options: {
background: false,
server: '<%= config.dist %>',
rewriteRules:[
{
match: /learn/g,
fn: function(req, res, match){
return 'a page is working';
}
}
]
}
### lite-server config
{
"port": 8000,
"files": ["./src/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./src" }
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.