New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vanilla-extract/webpack-plugin

Package Overview
Dependencies
Maintainers
4
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vanilla-extract/webpack-plugin

Zero-runtime Stylesheets-in-TypeScript

  • 2.1.12
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is @vanilla-extract/webpack-plugin?

@vanilla-extract/webpack-plugin is a plugin for integrating vanilla-extract with Webpack. Vanilla-extract is a CSS-in-TypeScript library that allows you to write type-safe, locally scoped styles. This plugin helps in compiling and bundling these styles efficiently with Webpack.

What are @vanilla-extract/webpack-plugin's main functionalities?

Basic Setup

This code demonstrates how to set up the @vanilla-extract/webpack-plugin in a Webpack configuration. It includes the necessary rules and plugins to process .css.ts files.

{"webpack.config.js":"const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin');\n\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css\\.ts$/,\n        use: [\n          'style-loader',\n          'css-loader',\n          '@vanilla-extract/webpack-plugin/loader'\n        ]\n      }\n    ]\n  },\n  plugins: [\n    new VanillaExtractPlugin()\n  ]\n};"}

Using with TypeScript

This code sample shows how to create a style using vanilla-extract in a TypeScript file. The `style` function is used to define CSS properties.

{"styles.css.ts":"import { style } from '@vanilla-extract/css';\n\nexport const myClass = style({\n  backgroundColor: 'blue',\n  color: 'white',\n  padding: '10px'\n});"}

Theming Support

This code demonstrates how to create a theme using vanilla-extract. The `createTheme` function is used to define theme variables that can be used throughout your application.

{"theme.css.ts":"import { createTheme } from '@vanilla-extract/css';\n\nexport const [themeClass, vars] = createTheme({\n  color: {\n    primary: 'blue',\n    secondary: 'green'\n  },\n  font: {\n    body: 'Arial, sans-serif'\n  }\n});"}

Other packages similar to @vanilla-extract/webpack-plugin

FAQs

Package last updated on 20 Aug 2022

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