Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grunt BrowserSync With Lite-Server #140

Open
codedcontainer opened this issue Jun 15, 2018 · 0 comments
Open

Grunt BrowserSync With Lite-Server #140

codedcontainer opened this issue Jun 15, 2018 · 0 comments

Comments

@codedcontainer
Copy link

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" }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant