mirror of
https://github.com/gromlab-ru/svg-sprites.git
synced 2026-07-22 04:40:17 +03:00
feat: standalone mode
This commit is contained in:
13
integration/apps/standalone/build.mjs
Normal file
13
integration/apps/standalone/build.mjs
Normal file
@@ -0,0 +1,13 @@
|
||||
import fs from 'node:fs'
|
||||
|
||||
fs.rmSync(new URL('./dist/', import.meta.url), { recursive: true, force: true })
|
||||
fs.mkdirSync(new URL('./dist/app-icons/', import.meta.url), { recursive: true })
|
||||
fs.copyFileSync(new URL('./index.html', import.meta.url), new URL('./dist/index.html', import.meta.url))
|
||||
fs.copyFileSync(
|
||||
new URL('./src/sprite/.svg-sprite/sprite.svg', import.meta.url),
|
||||
new URL('./dist/app-icons/sprite.svg', import.meta.url),
|
||||
)
|
||||
fs.copyFileSync(
|
||||
new URL('./src/sprite/.svg-sprite/svg-sprite.manifest.json', import.meta.url),
|
||||
new URL('./dist/app-icons/manifest.json', import.meta.url),
|
||||
)
|
||||
20
integration/apps/standalone/index.html
Normal file
20
integration/apps/standalone/index.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Standalone sprite fixture</title>
|
||||
<style>
|
||||
body { margin: 0; padding: 40px; font-family: system-ui, sans-serif; }
|
||||
[data-testid="icon"] { width: 64px; height: 64px; color: #16a34a; --icon-color-1: #16a34a; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Standalone</h1>
|
||||
<svg data-testid="icon" data-app="standalone" viewBox="0 0 24 24" aria-label="Check icon">
|
||||
<use href="/app-icons/sprite.svg#check"></use>
|
||||
</svg>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
13
integration/apps/standalone/package.json
Normal file
13
integration/apps/standalone/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@svg-sprites-fixtures/standalone",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"sprites": "svg-sprites src/sprite/svg-sprite.config.json",
|
||||
"build": "npm run sprites && node build.mjs",
|
||||
"dev": "npm run build && node ../../scripts/serve-static.mjs dist 4173"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gromlab/svg-sprites": "file:../../.."
|
||||
}
|
||||
}
|
||||
2
integration/apps/standalone/src/sprite/.gitignore
vendored
Normal file
2
integration/apps/standalone/src/sprite/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# @generated by @gromlab/svg-sprites. Do not edit.
|
||||
/.svg-sprite/
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"mode": "standalone",
|
||||
"name": "app-icons",
|
||||
"inputFiles": ["../../../../fixtures/icons/check.svg"],
|
||||
"generatedNotice": false
|
||||
}
|
||||
Reference in New Issue
Block a user