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

@ysione/wrap-css

v1.0.7

Published

Wrap your css/scss selector with one config

Downloads

52

Readme

wrap-css

One ring to rule them all

wrap-css is a cli package, for wrapping your CSS/SCSS selector and applying changes on the fly


Features

  • SCSS compatible
  • Wrap a list of .css, .scss files
  • Chose export folder
  • Scope your wrappers
  • Wrap whole selctor or each part of it
  • Build files on changes

Install

Install the package

npm i @ysione/wrap-css

Afterwards in root folder create a config file

npx @ysione/wrap-css init

This will generate next file

module.exports = {
  watch: ["index.css"],
  export: "modified",
  modifiers: [
    {
      name: "",
      prefix: "",
      sufix: "",
      wrapperPrefix: "",
      wrapperSufix: "",
    },
  ],
}

Set path to your .css, .scss files, chose path for export and use one of the commads:

// to wrap selector
npx @ysione/wrap-css wrap
// to watch files for changes and rebuild export files
npx @ysione/wrap-css watch

Configuration

Default export

module.exports = {
  watch: ["index.css"],
  export: "modified",
  modifiers: [
    {
      name: "",
      prefix: "",
      sufix: "",
      wrapperPrefix: "",
      wrapperSufix: "",
    },
  ],
}

Config

| property | type | description | | :-------: | :--------: | :------------------------------------------------------ | | watch | string[] | An array of paths to .css, .scss files | | export | string | Path in your root directory for exporting files | | modifiers | Modifier[] | Each modifier will be applied to files from watch array |

Modifier

| property | type | description | | :-----------: | :------: | :--------------------------------------------------------------------------------------------------- | | name | string | Name for export file | | prefix | string | String for the beginnig of selector | | sufix | string | String for the end of selector | | wrapperPrefix | string[] | Strings for the beginnig of file | | wrapperSufix | string[] | Strings for the end of file | | each | boolean | Defines whether script will wrap whole selector, or each part of the selector | | scope | string[] | A modifier can be scoped to apply changes to specific types of selectors, such as class, element |

Example

SCSS

  • wrap-css removes all @import and @use lines to escape path resolving problems, therefore please move them to the wrapperPrefix or wrapperSufix
  • Move your maps to a different file, so they don't get duplicated

config

module.exports = {
  watch: ["./styles/index.scss"],
  export: "modified",
  modifiers: [
    {
      name: "Kujiro",
      prefix: "#{$bpName}\\:",
      sufix: "",
      wrapperPrefix: [
        "/*\r\n",
        "       .\r\n",
        '      ":"\r\n',
        '    ___:____      |"\\/"|\r\n',
        "  ,'        `.    \\  /\r\n",
        "  |  O        \\___/ |\r\n",
        "~^~^~^~^~^~^~^~^~^~^~^~^~\r\n",
        "*/\r\n",
        "\r\n",
        '@import "../../styles/config.scss";\r\n',
        "\r\n",
        "@each $bpName, $value in $breakpoints {\r\n",
        "@media (min-width: $value) {\r\n",
      ],
      wrapperSufix: ["}\r\n", "}\r\n"],
    },
  ],
}

index.scss

@import "config.scss";

//display
@each $name, $value in $display {
  .#{$name} {
    display: $value;
  }
}

Kujiro.scss

/*
       .
      ":"
    ___:____      |"\/"|
  ,'        `.    \  /
  |  O        \___/ |
~^~^~^~^~^~^~^~^~^~^~^~^~
*/

@import "../../styles/config.scss";

@each $bpName, $value in $breakpoints {
  @media (min-width: $value) {
    //display
    @each $name, $value in $display {
      .#{$bpName}\:#{$name} {
        display: $value;
      }
    }
  }
}

CSS

config

module.exports = {
  watch: ["index.css"],
  export: "modified",
  modifiers: [
    {
      name: "Kujiro",
      prefix: "whale-",
      sufix: "-swim",
      wrapperPrefix: [
        "/*\r\n",
        "       .\r\n",
        '      ":"\r\n',
        '    ___:____      |"\\/"|\r\n',
        "  ,'        `.    \\  /\r\n",
        "  |  O        \\___/ |\r\n",
        "~^~^~^~^~^~^~^~^~^~^~^~^~\r\n",
        "*/\r\n",
      ],
      wrapperSufix: "",
    },
  ],
}

index.css

.content {
  width: 100%;
  font-size: 1rem;
}

.header {
  display: flex;
}

p {
  margin: 0;
  padding: 0;
}

Kujiro.css

/*
       .
      ":"
    ___:____      |"\/"|
  ,'        `.    \  /
  |  O        \___/ |
~^~^~^~^~^~^~^~^~^~^~^~^~
*/

.whale-content-swim {
  width: 100%;
  font-size: 1rem;
}

.whale-header-swim {
  display: flex;
}

whale-p-swim {
  margin: 0;
  padding: 0;
}

Scoped Example

config

module.exports = {
  watch: ["index.css"],
  export: "modified",
  modifiers: [
    {
      name: "Kujiro",
      prefix: "whale-",
      sufix: "-swim",
      wrapperPrefix: [
        "/*\r\n",
        "       .\r\n",
        '      ":"\r\n',
        '    ___:____      |"\\/"|\r\n',
        "  ,'        `.    \\  /\r\n",
        "  |  O        \\___/ |\r\n",
        "~^~^~^~^~^~^~^~^~^~^~^~^~\r\n",
        "*/\r\n",
      ],
      wrapperSufix: "",
      scope: ["class"],
    },
  ],
}

index.css

.content {
  width: 100%;
  font-size: 1rem;
}

.header {
  display: flex;
}

p {
  margin: 0;
  padding: 0;
}

Kujiro.css

/*
       .
      ":"
    ___:____      |"\/"|
  ,'        `.    \  /
  |  O        \___/ |
~^~^~^~^~^~^~^~^~^~^~^~^~
*/

.whale-content-swim {
  width: 100%;
  font-size: 1rem;
}

.whale-header-swim {
  display: flex;
}

p {
  margin: 0;
  padding: 0;
}