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

@csstools/postcss-rebase-url

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@csstools/postcss-rebase-url

Rebase url() functions when transforming CSS

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
736
decreased by-23.97%
Maintainers
0
Weekly downloads
 
Created
Source

PostCSS Rebase URL PostCSS Logo

npm install @csstools/postcss-rebase-url --save-dev

PostCSS Rebase URL rebases url() functions when transforming CSS.

When bundling CSS, the location of the final stylesheet file will be different than the individual source files.
PostCSS Rebase URL rewrites the contents of url() functions so that relative paths continue to work.

Instead of manually mapping where the files will be in the final output you can use this plugin
and simply use the relative paths to each source file.

If you need something with more knobs and dials, please checkout postcss-url

/* when used with a bundler like `postcss-import` */

/* test/examples/example.css */
@import url("imports/basic.css");

/* test/examples/imports/basic.css */
.foo {
	background: url('../../images/green.png');
}

/* becomes */

/* test/examples/example.expect.css */
.foo {
	background: url("../images/green.png");
}

Usage

Add PostCSS Rebase URL to your project:

npm install postcss @csstools/postcss-rebase-url --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssRebaseURL = require('@csstools/postcss-rebase-url');

postcss([
	postcssRebaseURL(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

Keywords

FAQs

Package last updated on 01 Nov 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