Socket
Socket
Sign inDemoInstall

goober

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

goober

A less than 1KB css-in-js solution


Version published
Weekly downloads
1.5M
decreased by-0.67%
Maintainers
1
Weekly downloads
Β 
Created

What is goober?

The goober npm package is a lightweight, less than 1KB CSS-in-JS solution designed for React, Preact, and vanilla JS projects. It provides a simple and efficient way to handle CSS styling in JavaScript applications, offering features like auto-prefixing, theming, and server-side rendering support.

What are goober's main functionalities?

Styled Components

Create styled components using tagged template literals. This feature allows you to style your components directly within your JavaScript files, maintaining a clear and concise workflow.

import { styled } from 'goober';

const Button = styled('button')`
  background-color: black;
  color: white;
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
`;

<Button>Click me</Button>;

Theming

Support for theming allows you to define a theme object and use it throughout your application. This is particularly useful for maintaining a consistent design across all components.

import { ThemeProvider, useTheme } from 'goober';

const theme = {
  colors: {
    primary: 'blue'
  }
};

const ThemedComponent = () => {
  const theme = useTheme();
  return <p style={{ color: theme.colors.primary }}>Themed text</p>;
};

<ThemeProvider theme={theme}>
  <ThemedComponent />
</ThemeProvider>;

Server-Side Rendering

Goober provides built-in support for server-side rendering, which is crucial for SEO and performance. This feature allows you to extract all the CSS used in your components and embed it in your server-rendered HTML.

import { extractCss } from 'goober';

const css = extractCss();

const html = `<style id='_goober'>${css}</style>`;

Other packages similar to goober

Keywords

FAQs

Package last updated on 13 Jan 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