Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unocss/core

Package Overview
Dependencies
Maintainers
2
Versions
385
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unocss/core

The instant on-demand Atomic CSS engine.

  • 0.65.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @unocss/core?

@unocss/core is a highly customizable and performant utility-first CSS framework. It allows developers to generate CSS on-demand, providing a flexible and efficient way to style applications. The package is designed to be framework-agnostic and can be integrated with various front-end frameworks.

What are @unocss/core's main functionalities?

On-Demand CSS Generation

This feature allows you to generate CSS on-demand based on utility classes. The code sample demonstrates how to create a generator and generate CSS for specific utility classes.

import { createGenerator } from '@unocss/core';

const uno = createGenerator();

const { css } = await uno.generate('p-4 m-2 text-center');
console.log(css);

Customizable Presets

This feature allows you to use and customize presets to extend the functionality of the CSS generator. The code sample shows how to use the `presetUno` preset to generate CSS for utility classes.

import { createGenerator, presetUno } from '@unocss/core';

const uno = createGenerator({
  presets: [presetUno()],
});

const { css } = await uno.generate('bg-blue-500 text-white');
console.log(css);

Integration with Frameworks

This feature allows you to integrate @unocss/core with various front-end frameworks like Vite. The code sample demonstrates how to create a Vite plugin that uses @unocss/core to transform code and generate CSS.

import { createGenerator } from '@unocss/core';
import { defineConfig } from 'vite';

const uno = createGenerator();

export default defineConfig({
  plugins: [
    {
      name: 'unocss',
      transform(code) {
        const { css } = uno.generate(code);
        return css;
      },
    },
  ],
});

Other packages similar to @unocss/core

Keywords

FAQs

Package last updated on 19 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc