Fix svg sprite
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Philipp Lang 2023-06-01 11:31:12 +02:00
parent 1d8b5b4670
commit 9e1fe63c33
4 changed files with 28 additions and 18 deletions

View File

@ -24,7 +24,7 @@ steps:
- name: node - name: node
image: node:17.9.0-slim image: node:17.9.0-slim
commands: commands:
- npm ci && npm run prod && npm run img && rm -R node_modules - npm ci && npm run img && npm run prod && rm -R node_modules
- name: phpunit_tests - name: phpunit_tests
image: php:8.1.6 image: php:8.1.6

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
/node_modules /node_modules
/public/build /public/build
/public/sprite.svg
/public/hot
/storage/*.key /storage/*.key
/vendor /vendor
.env .env

View File

@ -2,12 +2,12 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "npm run development", "dev": "npm run development",
"development": "npx mix build", "development": "npx vite",
"watch": "npx mix watch", "watch": "npx vite",
"hot": "npx mix watch --hot", "hot": "npx vite",
"prod": "npx mix build --production", "prod": "npx vite build",
"production": "npm run prod", "production": "npm run prod",
"img": "rm -R public/img && cd resources/img/svg && npx svg-sprite -s --symbol-dest=sprite *.svg && mv sprite/svg/sprite.css.svg ../sprite.svg && rm -R sprite && cd ../../../ && cp -R resources/img public/img", "img": "cd resources/img/svg && npx svg-sprite -s --symbol-dest=sprite *.svg && mv sprite/svg/sprite.css.svg ../../../public/sprite.svg && rm -R sprite",
"lint": "eslint \"resources/js/**/*.{js,vue}\"", "lint": "eslint \"resources/js/**/*.{js,vue}\"",
"fix": "eslint \"resources/js/**/*.{js,vue}\" --fix" "fix": "eslint \"resources/js/**/*.{js,vue}\" --fix"
}, },

View File

@ -1,17 +1,25 @@
export default { export default {
props: { props: {
src: { required: true, type: String } src: {required: true, type: String},
}, },
render: function(createElement) { render: function (createElement) {
var attr = this.$attrs.class ? this.$attrs.class : ''; var attr = this.$attrs.class ? this.$attrs.class : '';
return createElement('svg', { return createElement(
class: attr + ' fill-current' 'svg',
}, [ {
createElement('use', { class: attr + ' fill-current',
'attrs': { },
'xlink:href': `/img/sprite.svg#${this.$props.src}` [
} createElement(
}, '') 'use',
] ); {
} attrs: {
'xlink:href': `/sprite.svg#${this.$props.src}`,
},
},
''
),
]
);
},
}; };