Grunt: is there a way to load a determinate file or url, based on current path

110 Views Asked by At

I am building a site, and in a case, users will get to the site with some parameters in the url. Something like this:

http://example.org/params/param1/param2

I need Grunt to recognize this url, and load the / root of the site, where I read those parameters.

I cannot receive the parameters in another way,

is there a way to solve this?

EDIT

connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect().use(
                '/app/styles',
                connect.static('./app/styles')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
1

There are 1 best solutions below

0
Tom On

Livereload isn't the issue here. You're presumably viewing your website at a url like http://localhost, which is pointing to a server instance somewhere else (be it through another Grunt command, or python -m SimpleHTTPServer/php -S localhost, etc, or Apache, Nginx, etc). It is whatever that software is that needs this configuration. If you need a hand with this, open another question specific to that software, and I'm sure someone will be able to help!