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

@uppercod/postcss-import

v1.7.4

Published

resolves the `@import` and creates the `tree` property in the result object, which defines the imports

Readme

@uppercod/postcss-import

resolves the @import and creates the tree property in the result object, which defines the imports.

  1. Import and know the imports associated with the CSS.
  2. Group the import under an alias to compose CSS.
  3. Optimize parallel import.
  4. Consume CSS from URL.

Install

npm install @uppercod/postcss-import

Usage

import postcss from "postcss";
import { pluginImport } from "@uppercod/postcss-import";

postcss([pluginImport()]).process(`@import "http://unpkg.com/example.css";`, {
    from: "example.css",
});

Options

The options are parameters that are mutable by the process that optimize the execution of this plugin, the plugin internally has a cache system to avoid multiple executions of postcss, to improve performance you can share this cache.

pluginImport({
    /**
     * Cache local processes, the process object can be
     * shared between multiple instances
     */
    process: {},
    /**
     * Stores the paths of the local files imported by the process
     */
    imports: {},
    /**
     * Allows you to override the default module resolution process
     * @param {string} id
     * @param {string} importer
     */
    resolve(id, importer) {
        return {
            // module resolution id
            id,
            // read css
            css: `.myCss{}`,
            // skip the scan and add it to the top header as import
            external: true,
            // associate the import with a cache to avoid processing the content
            cache: true,
        };
    },
});

You can customize the resolution and reuse the plugin resolver, eg:

import { pluginImport, resolve } from "@uppercod/postcss-import";

Optimization

const cache = {};

postcss([pluginImport(cache)]).process(`@import "./file.css";`, {
    from: "a.css",
});

postcss([pluginImport(cache)]).process(`@import "./file.css";`, {
    from: "b.css",
});

postcss([pluginImport(cache)]).process(`@import "./file.css";`, {
    from: "c.css",
});

The import plugin will run only once for the file file.css.

Group the import under an alias to compose CSS.

special feature of this plugin that allows associating the import to a group, to be associated based on that group with other rules, eg:

@import "https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css" (as: bulma);

.button {
    @extend bulma.button, bulma.is-dark;
    @extend bulma"a button";
}