Comments (2)
tl;dr
Upgrade your Laravel Mix SVG Vue Version:
# npm
npm install laravel-mix-svg-vue@^0.4.1
# yarn
yarn add laravel-mix-svg-vue@^0.4.1
Enable removeViewBox
and disable removeDimensions
in the SVGO settings, e.g.:
mix.js('resources/js/app.js', 'public/js')
.vue()
.svgVue({
svgoSettings: [
{ removeViewBox: true },
{ removeDimensions: false }
]
});
Explanation
Older versions of this plugin only respected the viewBox
attribute of the SVGO generated string. I'm actually surprised that this wasn't mentioned before, could be because viewBox
is mainly prefered over the width
/height
attributes. Besides this plugin, SVGO also has this option enabled as default setting.
New versions of the svg-vue
and svg-vue3
components have been released that include every attribute that SVGO generates as optimized version.
Based on your SVGO settings, you have to enable or disable the removeViewBox
or removeDimensions
to get either the viewBox
or width
/height
attributes. That means you have to use the following settings to keep the width
and height
attributes:
.svgVue({
svgoSettings: [
{ removeViewBox: true },
{ removeDimensions: false }
]
})
You can check the defaults of SVGO here: SVGO Bult-in plugins
I've tagged a new version of Laravel Mix SVG Vue which includes the new Vue.js components. Upgrading to laravel-mix-svg-vue@^0.4.1
should fix your issues.
Let me know if the new version produces the desired output of the svg.
from laravel-mix-svg-vue.
Perfect! Thanks so much for fixing this issue.
The new version produces exactly the desired output from all of my svgs. :)
from laravel-mix-svg-vue.
Related Issues (12)
- Error: You may need an appropriate loader to handle this file type HOT 1
- Update svgo version by deprecated utility HOT 4
- How to use removeAttrs
- Unique IDs HOT 2
- Incorrect icon displays with v-if, works correctly with v-show HOT 2
- Laravel Mix 6 + Vue 3 Support HOT 4
- Handle style tags inside svg HOT 5
- Vue 3 without options API HOT 5
- How to use with Jetstream(Inertia) HOT 2
- Issues with Laravel Mix 6.0.20 and above? HOT 14
- Prevent from stripping viewBox HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-mix-svg-vue.