🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

vite-plugin-css-url

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-css-url

Make ?url imports work for css in vite

0.1.6
latest
Source
npm
Version published
Weekly downloads
23
228.57%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-css-url

This vite plugin allows you to ?url import css files and have them resolve to the final bundled css file.

In short, you can write import styles from './my/styles.scss?url' and have it actually work as you would expect. If you try to do this in vite it will sorta work in development mode but in release mode it will return the raw source code for the styles file (see https://github.com/vitejs/vite/issues/2522).

Installation

npm

npm install --save-dev vite-plugin-css-url

yarn

yarn install -D vite-plugin-css-url

pnpm

pnpm install -D vite-plugin-css-url

Usage

Use the plugin in your vite config

import ViteCssUrlPlugin from 'vite-plugin-css-url';

export default {
    plugins: [
        ViteCssUrlPlugin(),
    ]
}

Keywords

vite

FAQs

Package last updated on 05 Feb 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