
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@rei/cdr-icon
Advanced tools
cdr-icon
can support 3 different ways of getting svg icons onto your page.
Requires:
The sprite needs to be available on any page where the icons will be used so it's best to do it at the base layout/index
// Base view template (assuming .vue and vue-router)
<template>
<div id="main">
<cdr-icon-sprite />
<router-view></router-view> // rest of app
</div>
</template>
<script>
import { CdrIconSprite } from '@rei/cdr-icon';
...
components: {
CdrIconSprite
}
...
</script>
// -----------------------------------------------------------------
// Then in any descendant child component template
<cdr-icon use="#caret-right" />
Requires:
file-loader
)svgxuse
or svg4everybody
Within an individual component (you can probably come up with a better way to scale this if you need to do it in a lot of places):
// A .vue file
<template>
...
<cdr-icon :use="`${iconUrl}#caret-right`" />
...
</template>
<script>
// import the sprite so file-loader will do its magic
@import iconUrl from '@rei/cdr-assets/dist/cdr-icons.svg`;
export default {
...
data() {
return {
iconUrl
};
}
}
</script>
This method will bloat your HTML if using a lot of icons.
This is the easiest way to get an icon on your page. But use it carefully.
Requirements:
@rei/cdr-icon
installed<template>
...
<icon-caret-right />
<icon-clock />
...
</template>
<script>
import { IconCaretRight, IconClock } from '@rei/cdr-icon';
...
components: {
IconCaretRight,
IconClock
}
...
</script>
This method will bloat your HTML if using a lot of icons.
cdr-icon
is simply an svg (with some default attributes set -- mostly for a11y and styling) and a slot. Any svg markup can go inside of it. Any attributes added will simply override the defaults.
Requirements:
None, but you might find the example below helpful.
<template>
...
<cdr-icon viewBox="0 0 30 30">
<title>My icon</title>
<path d="M12 12c1.9329966 0 3.5-1.5670034 3.5-3.5C15.5 6.56700338 13.9329966 5 12 5S8.5 6.56700338 8.5 8.5c0 1.9329966 1.5670034 3.5 3.5 3.5zm6.7621385 7c-.8850139-2.8946791-3.5777143-5-6.7621387-5-3.1844245 0-5.87712493 2.1053209-6.76213876 5H18.7621385zM4 21c-.55228475 0-1-.4477153-1-1h-.00754862a9.07963802 9.07963802 0 0 1 .01314502-.1064258c.00185549-.0175393.0041644-.0349433.00691478-.0522001.43595408-3.2192393 2.56090871-5.9021068 5.45328094-7.1270196C7.26398091 11.7054407 6.5 10.191939 6.5 8.5 6.5 5.46243388 8.96243388 3 12 3c3.0375661 0 5.5 2.46243388 5.5 5.5 0 1.6919391-.763981 3.2054409-1.9657923 4.2143547 2.8923661 1.2249103 5.0173178 3.9077692 5.4532779 7.1269995.0027529.0172699.0050636.0346873.0069201.0522401A9.07834213 9.07834213 0 0 1 21.0075481 20H21c0 .5522847-.4477153 1-1 1H4z"/>
</cdr-icon>
...
</template>
<script>
@import { CdrIcon } from '@rei/cdr-icon';
...
components: {
CdrIcon
}
...
</script>
FAQs
REI Cedar Style Framework - Vue Component for Icon
We found that @rei/cdr-icon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.