1

フォントと画像 (アセット全般) をデータ属性に変換するにはどうすればよいですか?

この方法でアセットの読み込みが速くなったり遅くなったりしますか?

4

3 に答える 3

2

You should be aware that DataURI's are not supported by IE earlier than IE8. Also, IE8 has a limitation for at most 32KB of dataURI's in css assets. A more detailed description about DataURI's can be found at this blog post.

If you need the java implementation, you can find one here:

This allow you to transform all images into a base64 encoded uri in css files. For more details about how to integrate this implementation into your project, visit this page:

Disclosure: I'm affiliated to wro4j project.

于 2011-07-24T12:37:48.223 に答える
1

個別のファイルをキャッシュできる一方で、リクエストごとにデータをダウンロードする必要があるため、ページの読み込みが遅くなります。小さなファイルのみにデータ URI を使用するようにしてください。

画像の uri エンコーダー: http://www.scalora.org/projects/uriencoder/

于 2011-06-26T20:46:22.217 に答える
0

FileSystem APIのメソッドを使用できますreadAsDataURL。ただし、現時点ではクロムでのみ機能します。

于 2011-06-26T21:19:15.910 に答える