xiaofu-ruoyi-vue/node_modules/svg-sprite-loader/examples/extract-mode
ffr b5131258d8 第一次提交 2024-04-23 08:05:40 +08:00
..
build 第一次提交 2024-04-23 08:05:40 +08:00
README.md 第一次提交 2024-04-22 22:43:17 +08:00
main.css 第一次提交 2024-04-23 08:05:40 +08:00
main.html 第一次提交 2024-04-23 08:05:40 +08:00
main.js 第一次提交 2024-04-23 08:05:40 +08:00
webpack.config.js 第一次提交 2024-04-23 08:05:40 +08:00

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="">