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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rollup-plugin-material-all

v1.2.2

Published

Develop with @material/web/all.js - Build what's needed.

Downloads

63

Readme

Rollup/Vite plugin that imports only the elements needed during runtime.

(So you can use @material/web/all.js during development and don't have to worry writing imports yourself ✨)

Install

npm add -D rollup-plugin-material-all

(You'll also need to install @material/web separately)

Usage

🛠️ During development

do not use the plugin, all you need to do is to import the all.js module from the core library somewhere in your source:

import '@material/web/all.js';

That's it !

📦 At build time

import the plugin like so

rollup.config.js:

import {materialAll} from 'rollup-plugin-material-all';

// Required to prevent using the plugin during development
const DEV = process.env.NODE_ENV == 'DEV';

export default {
	plugins: [
		DEV ? {} : materialAll(),
		// other plugins...
	],
};

vite.config.js:

import {materialAll} from 'rollup-plugin-material-all';
import {defineConfig} from 'vite';

export default defineConfig({
	plugins: [
		// Won't be used during dev
		materialAll(),
	],
});

Details

The plugin will scan your sources to find all md-* elements used in your code.
By default this pattern will be used: src/**/*.{js,ts,jsx,tsx}
but you can always specify a different value in the options:

materialAll({
	// Only ts files
	include: 'src/**/*.ts',
});

Resolution Mode

If not specified rollup-plugin-material-all will use the perFile resolution mode (which is probably what you will need), there are 2 different methods:

  • perFile: Elements are imported in each individual file where they are being used. Use this method to improve code-splitting as your bundler will have a better understanding of your app's module dependencies graph.
  • all: All imports of elements found in the sources will be written in place of @material/web/all.js. Use this method if you'd rather want to bundle all your elements in one location which is not recommended since it can increase your page initial load time.

Additional elements

Sometimes md-* elements are imported from external libraries, in that case additionalElements can be used to specify these elements:

materialAll({
	additionalElements: ['md-circular-progress', 'md-dialog'],
});

License

MIT