npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grunt-localtunnel-client

v1.0.0

Published

Expose a local server to the world using Localtunnel

Readme

grunt-localtunnel-client NPM version Dependency Status

Expose a local server to the world using Localtunnel

grunt-localtunnel-client exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.

Great for testing in physical mobile devices, working with browser testing tools or external api callback services which require a public url for callbacks.

Getting Started

This plugin requires Grunt.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-localtunnel-client --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-localtunnel-client');

The "localtunnel_client" task

Note that this server only runs as long as grunt is running. Once grunt's tasks have completed, the web server stops. This behavior can be changed with the keepalive option, and can be enabled ad-hoc by running the task like grunt localtunnel_client:keepalive.

This task was designed to be used in conjunction with another task that is run immediately afterwards, like the grunt-contrib-watch plugin watch task.

Overview

In your project's Gruntfile, add a section named localtunnel_client to the data object passed into grunt.initConfig().

grunt.initConfig({
    localtunnel_client: {
        server: {
            options: {
                port: 8000,
                subdomain: 'mytestdomain'
            }
        }
    }
})

It will connect to the localtunnel server, setup the tunnel, and tell you what url to use for your testing. This url will remain active for the duration of your session; so feel free to share it with others.

Options

port

Type: Integer
Default: 8000

Local server port. The server should already be listening to this port before attempting to tunnel.

subdomain

Type: String Default: undefined

A string value requesting a specific subdomain on the proxy server. Subdomains must be lowercase and between 4 and 63 alphanumeric characters. Note You may not actually receive this name depending on availablily. If no specied a random subdomain will be assigned.

local_host

Type: String Default: localhost

The hostname where your local server is running. This will also cause the Host header to be re-written to this value in proxied requests.

keepalive

Type: Boolean
Default: false

Keep the server alive indefinitely. Note that if this option is enabled, any tasks specified after this task will never run. By default, once grunt's tasks have completed, the web server stops. This option changes that behavior.

This option can also be enabled ad-hoc by running the task like grunt localtunnel_client:targetname:keepalive

onSuccess

Type: Function Default: function(tunnel){}

Custom callback for tunnel success. Receives the tunnel instance as its only argument.

onError

Type: Function Default: function(err){}

Custom callback for tunnel errors. Receives the tunnel error as its only argument.

Example

grunt.initConfig({
    localtunnel_client: {
        server: {
            options: {
                port: 8001,
                subdomain: 'myothertestdomain',
                local_host: 'myotherhost',
                keepalive: true,
                onSuccess: function(tunnel) {
                    grunt.log.ok('Connected at: ', tunnel.url);
                },
                onError: function(err) {
                    grunt.log.error('Not cool! ', err);
                }
            }
        }
    }
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 1.0.0 [30/04/2017]
    • Major code overhaul
    • Better error prevention
    • More intuitive messages
  • 0.1.0 [24/04/2017]
    • Initial release

License

MIT © Renato Rodrigues