daquirm / base64-fold Goto Github PK
View Code? Open in Web Editor NEWA Sublime Text plug-in that automatically folds base64-encoded data URIs in your CSS files
A Sublime Text plug-in that automatically folds base64-encoded data URIs in your CSS files
Maybe it would be better to rewrite base64 encoding-matching regex with verbal expressions - a Python port should exist.
Data URIs encoded in Base64 may contain whitespace for human readability.
(From https://en.wikipedia.org/wiki/Data_URI_scheme#Syntax)
Example:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
<style type="text/css">
span {
padding-left: 20px;
background:white url('data:image/png;base64,iVBORw0KGgoAA\
AANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0l\
EQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6\
P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC') no-repeat scroll left top;
}
/* Backslashes at end of line - to continue character string
at new line. */
</style>
<span>Test</span>
</body>
</html>
Currently the img
only gets the first line (iVBORw0KGgoAAAANSUhEUgAAAAUA
) folded (with base64fold_all_uris
set to false), leaving the other lines unfolded. The uri('
in the CSS doesn't get folded at all.
Base64 folding doesn't work in case when url is quoted.
When "base64fold_all_uris": true
is set in the Preferences (which is the default), inline "img src" base64 data isn't folded automatically on save or load.
Example:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />
It's not a major issue, but when I open a file containing some base64 code (for example, a CSS file) it is unfolded, and to have it folded you have to make a save. Is it so for a reason or it's a bug?
check size of base64 URIs when folding all URIs is on
This isn't really a bug, but it'd be nice to be able - for now it's not there - to install the plugin from ST3. It seems to be fully compatible.
See here. This is a useful technique that allows to include SVG code in CSS file. Usually looks like
list-style-image: url('data:image/svg+xml;utf8,<svg width="11px" height="11px" xmlns="http://www.w3.org/2000/svg"><path d="M6.56713392,6.3167819 ... Z" fill="red" stroke="black" stroke-width="1"></path></svg>');
base64-fold also fold rgba(0,0,0,.02) in css file
rgba(0,0,0,.02) fold to rgba(0,...) and can not unfold so I can't edit color setting. hope you could fix this, many thanks!
Hello,
This is a great plugin, but I'm using AZERTY keyboard, [ and ] are unreachable on mac ;)
How to change the key-binds ?
Thanks.
base64 is not folding in markdown (.md) file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.