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

nuxt-lazyload-files

v1.1.2

Published

Module to allow lazy load specific files, so they're only imported when used (e.g.: screen size related stylings)

Downloads

8

Readme

nuxt-lazyload-files

Latest version npm downloads npm Publish workflow

Features

This module allows you to configure your nuxt app to import files as needed. By default nuxt will load every css, js, whatever else file. In many cases, this delays first paint and impacts performance and the feel of website, as in many cases this stuff might not be needed yet (or won't be needed at all as it can be platform specific code, such mobile only CSS styles).

This module adds 2 functionalities to your project:

  • the actual module bit, which prepares the files to be lazy loaded during build
  • a plugin that runs on client only, and handles the actual loading based on the file time and the rules configured

Quick Setup

Install the module to your Nuxt application with one command:

  • npm: npx nuxi module add nuxt-lazyload-files
  • bun: bunx nuxi module add nuxt-lazyload-files
  • yarn berry: yarn dlx nuxi module add nuxt-lazyload-files

In your nuxt.config you'll need to specify which rules (available rules) to apply and add either:

  • inputDir, a path where the files to lazy load are, and the module will try to process all files in it
  • files.[type], any specific files you want to lazy load

You can specify both and it'll try to process all files in inputDir first and all specific files in files. Any duplicate files are ignored. :information_source:Duplicate files are determined by path + filename, for example if you specify inputDir: "mydir" and files.css: ["mydir/myfile"], myfile will be ignored when processing files

Rules can specified both global (will apply to all files of type) or specific to each file. You'll need to specify at least one rule or nothing will happen

lazyLoadFiles: {
  inputDir?: "path/to/dir";
  files?: {
    css: [
      { filePath: ["path/to/specific/file.scss"], {...<rule configuration>} }
    ]
  }
  {...<rule configuration>}
}

:exclamation:Don't import files that you want to lazy load any other way (from other files, css prop in nuxt.config, etc). This will result in those files being loaded twice: first by nuxt on first load automagically, secondly whenever the loading rules are true

:white_check_mark:That's it! You can now use nuxt-lazyload-files in your Nuxt app ✨

Supported files and rules

At the moment this module only supports plain Stylus, SASS, LESS or plain CSS

These files also get compiled into plain CSS during build time, and it's those that the plugin uses

| Rule | Config | Supported format | Description | | ---------------------- | ----------------- | ----------------- | --------------------------------------------------------- | | windowWidthGreaterThan | { width: number } | SASS, Stylus, LESS, CSS | Loads the files when window width is greater than width | | windowWidthLessThan | { width: number } | SASS, Stylus, LESS, CSS | Loads the files when window width is less than width |

Contribution

Any and all help is always welcome, check open issues or the project if you're not too sure what to work on

# Install dependencies
bun install

# Generate type stubs
bun run dev:prepare

# Develop with the playground
bun run dev

# bun the playground
bun run dev:build

# Run ESLint
bun run lint

# Run Vitest
bun run test
bun run test:watch

# Release new version
bun run release

Link package for local debugging

If you're developing something and want to test against a real example project, or are debugging something in your project that uses this module, you can link both projects, effectively making your project use your local version of the module instead (as detailed here at around the 9 minute mark)

# Go the dependency in node modules and run bun link to enable linking
cd ./node_modules/nuxt-lazyload-files && bun link && cd -

# back at the root of your project do, link it to the package
bun link nuxt-lazyload-files