... | ... | @@ -4,6 +4,29 @@ h2. Introduction |
|
|
|
|
|
CSSEmbed is a simple utility to automate creation of CSS files with embedded data URIs. It can read in any CSS file, detect the image files referenced, and then replace them with data URIs. The result is a CSS file that is exactly the same as the original with the exception that all valid image files have been replaced with data URIs.
|
|
|
|
|
|
h2. Basic Usage
|
|
|
|
|
|
CSSEmbed is used as follows:
|
|
|
|
|
|
bc. java -jar cssembed-0.1.0.jar <options> <css file>
|
|
|
|
|
|
For example:
|
|
|
|
|
|
bc. java -jar cssembed-0.1.0.jar -v styles.css
|
|
|
|
|
|
The %-v% or %--verbose% flags result in additional messages and warnings being output to the console, which can be useful if you run into problems.
|
|
|
|
|
|
Using the %-h% option shows all of the options:
|
|
|
|
|
|
bc. Usage: java -jar cssembed-x.y.z.jar [options] [input files]
|
|
|
bc.
|
|
|
bc. Global Options
|
|
|
bc. -h, --help Displays this information.
|
|
|
bc. --charset <charset> Character set of the input file.
|
|
|
bc. -v, --verbose Display informational messages and warnings.
|
|
|
bc. -root <root> Prepends <root> to all relative URLs.
|
|
|
bc. -o <file> Place the output into <file>. Defaults to stdout.
|
|
|
|
|
|
h2. Resolving Files
|
|
|
|
|
|
When CSSEmbed comes across a URL reference in CSS (@url(filename)@), it inspects the filename to determine where the file is actually located. If the filename begins with "http://", then the file is downloaded from that location. Files that don't begin with "http://" are assumed to be local and their location is resolved relative to the location of the CSS file. If, for example, the CSS code contains @url(../../image.png)@, then CSSEmbed looks to the directory that is two levels above the CSS file for @image.png@.
|
... | ... | @@ -13,7 +36,3 @@ You can force a specific resolution by using the @--root@ option on the command |
|
|
bc. java -jar cssembed-0.1.0.jar --root http://www.nczonline.net/images styles.css
|
|
|
|
|
|
This causes all image URLs to be prepended with @http://www.nczonline.net/images% before attempting resolution (this happens only for those URLs that don't already have "http://" at the beginning. |
|
|
|
|
|
h2. Data URIs
|
|
|
|
|
|
Data URIs are a way to represent files inside of other files. For more information, please see my blog post |