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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@syntaxltd/vue-pjax

v1.0.4

Published

A Vue plugin to enhance your website performance with PJAX without relying on jQuery.

Readme

PJAX adapter for Vue

This Vue plugin was inspired by defunkt/jquery-pjax and depends on spatie/laravel-pjax.

Those people who use VueJS extensively in their (non-SPA) projects, PJAX could be lifesaving when optimising the user experience. Simply put, PJAX uses AJAX requests to manipulate the DOM at time of page changes thus reducing the load over the network and therefore improving response times.

Dependencies

The plugin itself depends on the vue and axios libraries and has been built to consume the PJAX server responses provided by the spatie/laravel-pjax package.

Installation

First things first, open up your terminal and pull in the plugin.

$ npm i @syntaxltd/vue-pjax

Next, you will have to specify the target container in your blade template. In the example below we called it #pjax-container (which is the default by the way).

<div id="app">
    @include('partials.header')

    <div>
        @include('partials.navigation')

        <main id="pjax-container">
            @yield('content')
        </main>
    </div>
</div>

Now go to your app.js file where you set up Vue and initialise the plugin.

require('./bootstrap');
window.Vue = require('vue');

import { PjaxEventBus, pjaxAdapter } from '@syntaxltd/vue-pjax';
window.Vue.use(pjaxAdapter);

// or if you don't like the default target, you can override it
// window.Vue.use(pjaxAdapter, {
//     targetSelector: '#my-custom-target',
// });

const app = new Vue({
    el: '#app'
});

As the final step, you will have to install Spatie's PHP library to play ball on the server side.

Once done, head to your browser and see the magic happen!

Options

You can override the default target container if you need to at time of initialisation.

window.Vue.use(pjaxAdapter, {
    targetSelector: '#my-custom-target',
});

Should you have any links you want to disable the PJAX behaviour for, you can do so in two ways: by adding the data-no-pjax attribute or by adding the no-pjax class.

<a href="/my-non-pjax-link-1" data-no-pjax>External Link 1</a>
<a href="/my-non-pjax-link-2" class="no-pjax">External Link 2</a>

If you have many of those under a common parent, you can do so by disabling the PJAX behaviour on the parent itself using either of the methods above.

<div data-no-pjax>
    <div>
        <h1>Some external links</h1>
        <ul>
            <li><a href="/my-non-pjax-link-1">External Link 1</a></li>
            <li><a href="/my-non-pjax-link-2">External Link 2</a></li>
            <li><a href="/my-non-pjax-link-3">External Link 3</a></li>
        </ul>
    </div>
    <div>
        <h1>Even more external links</h1>
        <ul>
            <li><a href="/my-non-pjax-link-4">External Link 4</a></li>
            <li><a href="/my-non-pjax-link-5">External Link 5</a></li>
            <li><a href="/my-non-pjax-link-6">External Link 6</a></li>
        </ul>
    </div>
</div> 

How it works

The plugin attaches an event listener to all the a[href] tags on your page at time of initialisation. When you click the link and you haven't disabled the PJAX behaviour, it takes over by preventing the default action and works with Spatie's PHP library to bring only the relevant content from the backend. Otherwise, it will let the default click event fall through and go on its merry way.

Performance

Configuration:

  • fresh install of Laravel with VueJS and Axios (nothing else);
  • a three link navigation: ul > li > a, nothing more complex;
  • three pages with only an h1 tag on each;
  • all run by Laravel Valet on localhost.

Test results without using the plugin: Test results without using the plugin

Test results with the plugin: Test results with the plugin

Bugs

Please report bugs using the issue tracker.

Contributing

You are more than welcome to help me maintain and extend this plugin.

About us

Riverskies Development Limited is a small software development company based in Surrey, UK.