
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@anvilco/reorient-css
Advanced tools
Updates relative asset URLs within a string of CSS to reflect a relocation of the CSS file.

Updates relative asset URLs (e.g. url(../images/something.png)) within a string of CSS to reflect a relocation of the CSS file.
Example use case: if you were inlining CSS from styles/main.css into a <style> element in index.html (as part of a build task aiming to reduce HTTP round trips), you could use this function to rewrite all the image/font URLs within the CSS so they still work from the new relative base – in this example, it would prepend all file-relative URLs with style/ (and resolve any .. etc).
npm install reorient-css
var reorientCSS = require('reorient-css');
var result = reorientCSS(
'body { background: url(something.png); }', // css string
'some/old/stylesheet/file.css', // old css location
'some/new/one.css' // new css location (this could even be an .html file,
); // if you're inlining the CSS into a <style> element
// - the basename is ignored anyway)
console.log(result.css);
// > body { background: url('../old/stylesheet/something.png'); }
data: URLs will be left untouched, as these are expected to work the same regardless of the CSS file's location.behavior properties (a proprietary IE thing) will be left untouched, because any URLs in these properties are relative to the HTML document, not the CSS file, so in theory they should never change.
.html files, behavior properties will be reoriented.css, which contains the reoriented CSS string. This object might also contain a map property, if you have specified that option (see below).The function accepts an optional fourth argument: an object of extra options to pass to PostCSS. For example, {map: true} will tell it to generate a source map (which will be available in the map key of the result object). See the PostCSS docs for more details.
reorient-css can also be used as a PostCSS processor.
var postcss = require('postcss'),
reorientCSS = require('reorient-css');
var result = postcss()
.use( reorientCSS.processor( 'some/old/stylesheet/file.css', 'some/new/one.css' ) )
.process( 'body { background: url(something.png); }' );
console.log(result.css);
// > body { background: url('../old/stylesheet/something.png'); }
Copyright (c) 2014 Callum Locke. Licensed under the MIT license.
FAQs
Updates relative asset URLs within a string of CSS to reflect a relocation of the CSS file.
We found that @anvilco/reorient-css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.