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

class2css

v1.1.4

Published

class2css is a plugin for Vite that converts CSS classes into meaningful CSS styles, simplifying the process of working with CSS in JavaScript applications. This plugin supports HMR (Hot Module Replacement) during development, enhancing performance and de

Downloads

72

Readme

class2css

class2css is a plugin for Vite that converts CSS classes into meaningful CSS styles, simplifying the process of working with CSS in JavaScript applications. This plugin supports HMR (Hot Module Replacement) during development, enhancing performance and development experience.

Installation

You can install class2css via npm:

npm install class2css

Configuration

To configure class2css with Vite, add it to your Vite configuration file (vite.config.js):

import { defineConfig } from 'vite';
import class2css from 'class2css';

export default defineConfig({
    plugins: [class2css()]
});

Usage

In all templates in your .vue files, you can use the following keywords as class names to generate the corresponding CSS styles. Here is a list of supported keywords: Dưới đây là danh sách các key:

| Key | Property | Example | | ------ |---------------------------------|------------------------------------------------------| | c | color | c-red -> color: red; | | bg | background-color | bg-blue -> background-color: blue; | | fs | font-size | fs-14 -> font-size: 14px; | | fw | font-weight | fw-bold -> font-weight: bold; | | w | width | w-100 -> width: 100px; | | h | height | h-200 -> height: 200px; | | m | margin | m-10 -> margin: 10px; | | p | padding | p-20 -> padding: 20px; | | bd | border | bd-1px-solid-black -> border: 1px solid black; | | br | border-radius | br-5 -> border-radius: 5px; | | ws | white-space | ws-nowrap -> white-space: nowrap; | | ov | overflow | ov-x-hidden -> overflow-x: hidden; | | z | z-index | z-10 -> z-index: 10; | | block | display | block -> display: block; | | inline | display | inline -> display: inline; | | inline_block | display | inline_block -> display: inline-block; | | none | display | none -> display: none; | | i | font-style | i -> font-style: italic; | | u | text-decoration | u -> text-decoration: underline; | | lt | text-decoration | lt -> text-decoration: line-through; | | o | text-decoration | o -> text-decoration: overline; | | fn | font-style | fn -> font-style: normal; | | tn | text-decoration | tn -> text-decoration: none; | | tb | font-weight | tb -> font-weight: bold; | | upp | text-transform | upp -> text-transform: uppercase; | | low | text-transform | low -> text-transform: lowercase; | | cap | text-transform | cap -> text-transform: capitalize; | | usn | user-select | usn -> user-select: none; | | usa | user-select | usa -> user-select: auto; | | row | layout (flex-direction: row) | row -> flex-direction: row; | | col | layout (flex-direction: column) | col -> flex-direction: column; | | static | position | static -> position: static; | | relative | position | relative -> position: relative; | | fixed | position | fixed -> position: fixed; | | absolute | position | absolute -> position: absolute; | | sticky | position | sticky -> position: sticky; | | t | edgePosition (top) | t-0 -> top: 0; | | r | edgePosition (right) | r-0 -> right: 0; | | b | edgePosition (bottom) | b-0 -> bottom: 0; | | l | edgePosition (left) | l-0 -> left: 0; | | vt | vertical-align | vt -> vertical-align: top; | | vm | vertical-align | vm -> vertical-align: middle; | | vb | vertical-align | vb -> vertical-align: bottom; | | tl | text-align | tl -> text-align: left; | | tc | text-align | tc -> text-align: center; | | tr | text-align | tr -> text-align: right; | | tj | text-align | tj -> text-align: justify; | | rl | align (left) | rl -> align: left; | | rc | align (center) | rc -> align: center; | | rr | align (right) | rr -> align: right; | | rt | align (top) | rt -> align: top; | | rm | align (middle) | rm -> align: middle; | | rb | align (bottom) | rb -> align: bottom; | | rw | align (space-between) | rw -> align: space-between; | | ra | align (space-around) | ra -> align: space-around; | | re | align (space-evenly) | re -> align: space-evenly; | | cl | align (left) | cl -> align: left; | | cc | align (center) | cc -> align: center; | | cr | align (right) | cr -> align: right; | | ct | align (top) | ct -> align: top; | | cm | align (middle) | cm -> align: middle; | | cb | align (bottom) | cb -> align: bottom; | | cw | align (space-between) | cw -> align: space-between; | | ca | align (space-around) | ca -> align: space-around; | | ce | align (space-evenly) | ce -> align: space-evenly; | | sd | box-shadow | sd-2px-2px-5px-gray -> box-shadow: 2px 2px 5px gray; | | cur | cursor | cur-pointer -> cursor: pointer; | | op | opacity | op-50 -> opacity: 0.5; | | to | text-overflow | to-ellipsis -> text-overflow: ellipsis; |

Here’s a basic example of how to use class2css in your .vue files:

<template>
  <div class="cap i c-red bg-blue">abc</div>
</template>

<script>
export default {
  name: 'ExampleComponent'
}
</script>

<style>
</style>

Automatically generate CSS as shown below. This helps us save a lot of time.

<template>
  <div class="cap i c-red bg-blue">abc</div>
</template>

<script>
export default {
  name: 'ExampleComponent'
}
</script>

<style>
/* The generated CSS will be: */
.cap {
  text-transform: uppercase;
}
.i {
  font-style: italic;
}
.c-red {
  color: red;
}
.bg-blue {
  background-color: blue;
}
</style>