You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ytt 2545d38280
代码
8 months ago
..
build 代码 8 months ago
README.md 代码 8 months ago
main.css 代码 8 months ago
main.html 代码 8 months ago
main.js 代码 8 months ago
webpack.config.js 代码 8 months ago

README.md

Extracted sprite example

Extract SVG sprite as separate file with extract: true option (see webpack config). When loader is in extract mode, the returning value is extracted sprite file URL with symbol id at the end, e.g. sprite.svg#symbolId. This makes possible to use SVG stacking technique which supported by most of browsers except of Safari (both desktop and mobile) and Android browser prior to 4.4.4.

Demo

Import from JS

Input

import './logo.svg';

Output

module.exports = 'sprite.svg#logo-usage';

Import from CSS

Input

.logo {background: url('./logo.svg')}

Output

.logo {background: url('sprite.svg#logo-usage')}

Import from HTML

Input

<img src="./logo.svg" alt="">

Output

<img src="sprite.svg#logo-usage" alt="">