excellentingenuity / laravel-mix-vue-svgicon Goto Github PK
View Code? Open in Web Editor NEWLaravel Mix extension that provides loading svgs as a vue component named icon, compatible with Adam Wathan's Blade extension.
License: MIT License
Laravel Mix extension that provides loading svgs as a vue component named icon, compatible with Adam Wathan's Blade extension.
License: MIT License
ex. if I want load the svg image from url, as https://xxx.xxx.com/file/some.svg, how can I do.
thanks.
When using with Mix v4.0.14 only the file name is outputted so the loader rules dosen't seem to be overridden.
Thanks for the package as it has been very useful.
I am having an issue where using this package seems to break the jest test with errors like:
Error: Cannot find module 'SVGPATH/foo.svg' from 'Icon.vue'
I am using the SVGPath in a vue component as follows:
// Icon.vue
getIcon(icon) {
return require(`SVGPATH/${icon}.svg`);
}
Tried adding the following to jest.setup.js
but no luck:
const mix = require('laravel-mix');
require('laravel-mix-vue-svgicon');
Is there any way we can get this working with the test suite? Thanks.
Hi there,
First of all, is this package still alive?
I found out there's a v3.01 available through this link , but it's not listed here on Github.
When using the v3 package, I get the following error:
[webpack-cli] TypeError: Cannot redefine property: tap
I'm using laravel-mix v6.
What can I do to fix this?
Updating the code to 2.1.1 version an error occurred on frontend.
Instead of showing the correct .svg file traslating the <template>
code, on frontend it's still the same of the the IconComponent.vue
, like this.
<object data="require(SVGPATH/${icon}.svg)" type="${icon}.svg" class="fill-current margin-right-16 width-16"></object>
Why?
Here's the code my webpack.min.js
const mix = require('laravel-mix')
require('laravel-mix-vue-svgicon')
mix.svgicon('./node_modules/svg-repository')
and on my example.vue
import Icon from 'laravel-mix-vue-svgicon/IconComponent.vue'
<icon :icon="logo" />
Thanx
In the docs you say that the default path is ./../public/resources/svg
to work with Adam Wathan's Blade SVG package. His package, which I have and works, uses the path resources/svg
. If I have mix in the root directory the this should be the correct location since the default doesn't work:
const mix = require('laravel-mix');
require('laravel-mix-tailwind');
require('laravel-mix-purgecss');
require('laravel-mix-vue-svgicon');
mix.js('resources/js/erro.js', 'public/js')
.sass('resources/sass/erro.scss', 'public/css')
.tailwind('tailwind.config.js')
.version()
.svgicon('resources/svg/logo.svg')
.purgeCss();
But I get the error Error: Can't resolve 'SVGPATH'
.
I have also tried:
.svgicon('./resources/svg/logo.svg')
So not sure why its not working and if you want to be inline with Adam Wathan's package the default should point to /resources/svg/
, not the public directory.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.