mirror of
https://github.com/gromlab-ru/svg-sprites.git
synced 2026-07-22 04:40:17 +03:00
28 lines
933 B
TypeScript
28 lines
933 B
TypeScript
|
|
import { compileSpriteContent } from '../../compiler.js'
|
||
|
|
import { createCompiledSpriteArtifact } from '../../core/compiled-artifact.js'
|
||
|
|
import type { ModeAdapter } from '../../core/mode-adapter.js'
|
||
|
|
import { generateOutputFiles } from './output.js'
|
||
|
|
|
||
|
|
export const svelteWebpackAdapter: ModeAdapter<'svelte@webpack'> = {
|
||
|
|
mode: 'svelte@webpack',
|
||
|
|
async generate(context) {
|
||
|
|
const bytes = await compileSpriteContent(
|
||
|
|
context.prepared.folder,
|
||
|
|
context.config.transform,
|
||
|
|
{ rootViewBox: false },
|
||
|
|
)
|
||
|
|
const artifact = createCompiledSpriteArtifact(bytes, context.prepared.iconNames, 'stack')
|
||
|
|
|
||
|
|
return {
|
||
|
|
files: generateOutputFiles(context.config, artifact),
|
||
|
|
paths: {
|
||
|
|
generatedDir: '.svg-sprite',
|
||
|
|
sprite: '.svg-sprite/sprite.svg',
|
||
|
|
manifest: '.svg-sprite/svg-sprite.manifest.js',
|
||
|
|
entry: '.svg-sprite/index.js',
|
||
|
|
},
|
||
|
|
result: { target: 'webpack' },
|
||
|
|
}
|
||
|
|
},
|
||
|
|
}
|