Skip to content

css Data Url Remover is a script that invokes ImageMagick, sed and awk, to cleanse .css files of any inline blob.

License

Notifications You must be signed in to change notification settings

Toso42/DataUrlRemover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

CSS Data URL Remover

Many wonderful CSS libraries rely on image-src data: rules, which are considered bad practice for Content Security Policy (CSP). This script aims to convert SVG blobs to PNG files.

Prerequisites for your Linux system:

  • bash
  • Node.js
  • ImageMagick
  • sed
  • awk

Instructions:

  1. Copy the script (you can do this by copying and pasting locally).
  2. Make the script executable by using the command chmod +x <script.sh>, where <script.sh> is the filename of the script.
  3. Run the script using ./<script.sh>, or any method you prefer.

What the script does: The script first creates a one-time backup of your file, then creates a subfolder named 'svg'. It then searches your CSS file for any url(data: rules and substitutes the blob path with a relative path ./svg/<file.png>.

WARNING! This script will permanently modify your .css file.

IF YOU FIND THE SCRIPT USEFUL, please consider giving this repo a star. Thanks!

About

css Data Url Remover is a script that invokes ImageMagick, sed and awk, to cleanse .css files of any inline blob.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages