Fix svg sprite
This commit is contained in:
parent
1d8b5b4670
commit
9e1fe63c33
|
@ -24,7 +24,7 @@ steps:
|
|||
- name: node
|
||||
image: node:17.9.0-slim
|
||||
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
|
||||
image: php:8.1.6
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/node_modules
|
||||
/public/build
|
||||
/public/sprite.svg
|
||||
/public/hot
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
|
|
10
package.json
10
package.json
|
@ -2,12 +2,12 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "npx mix build",
|
||||
"watch": "npx mix watch",
|
||||
"hot": "npx mix watch --hot",
|
||||
"prod": "npx mix build --production",
|
||||
"development": "npx vite",
|
||||
"watch": "npx vite",
|
||||
"hot": "npx vite",
|
||||
"prod": "npx vite build",
|
||||
"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}\"",
|
||||
"fix": "eslint \"resources/js/**/*.{js,vue}\" --fix"
|
||||
},
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
export default {
|
||||
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 : '';
|
||||
return createElement('svg', {
|
||||
class: attr + ' fill-current'
|
||||
}, [
|
||||
createElement('use', {
|
||||
'attrs': {
|
||||
'xlink:href': `/img/sprite.svg#${this.$props.src}`
|
||||
}
|
||||
}, '')
|
||||
] );
|
||||
}
|
||||
return createElement(
|
||||
'svg',
|
||||
{
|
||||
class: attr + ' fill-current',
|
||||
},
|
||||
[
|
||||
createElement(
|
||||
'use',
|
||||
{
|
||||
attrs: {
|
||||
'xlink:href': `/sprite.svg#${this.$props.src}`,
|
||||
},
|
||||
},
|
||||
''
|
||||
),
|
||||
]
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue