Source files for the Rivet icon set
Inside the /dist
folder there is a file called rvt-icons.svg
that a SVG sprite sheet that uses the <symbol>
element to bundle all of the Rivet icons together into one file. To use the bundled SVGs in your project:
- Download the
rvt-icons.svg
file. - You can either A.) inline the
rvt-icons.svg
file's contents in your page or B.) add the file to your project and reference the<symbol>
elements inside the sprite sheet with relative URLS. NOTE: this option requires a small polyfill to work in IE11). - Reference the SVG icon you want to use by its
id
attribute. - Choose a method for sizing your icons. In the examples below we're adding CSS class called
rvt-icon
, but you could usewidth
andheight
HTML attributes also.
.rvt-icon {
width: 1rem;
height: 1rem;
}
Using option A listed above:
<svg class="rvt-icon">
<use xlink:href="#rvt-icon-alarm"></use>
</svg>
Using option B listed above:
<svg class="rvt-icon">
<use xlink:href="./path/to/svg/rvt-icons.svg#rvt-icon-alarm"></use>
</svg>
If you would rather inline the source .svg
files in your HTML you can clone or download this repository and use the files in the ./src/svg/
directory.
All of the Rivet icon artwork can be found in the Illustrator file in src/rivet-icons-source.ai
. Each icon is drawn on it's own artboard to the following specifications:
- 16x16px grid
- 2px stroke for all icon outlines
- Expand all strokes before exporting and merge/flatten artwork in to one group.
- Set
fill
attribute tocurrentColor
on exported SVGs.
To add a newly-created icon to the preview page, follow these steps.
- Create a new feature branch off of
develop
. - Create the new icon artwork in the
/src/rivet-icons-source.ai
file. - Export the icon as an .svg with the strokes outlined and flattened into the
/src/svg
folder. Using the Export for Screens... option. From the main Illustrator menu go toFile
>Export
>Export for Screens...
Select thesrc/svg
folder as the destination and select the artboard for the new icon that you want to export as an SVG. - Once the new icon artwork has been expanded, flattened, and exported to the
src/svg
folder, typenpm run build
into your terminal to build the preview page. This will generate a preview for every file currently in the/src/svg/
directory. - Follow the instructions below to run the the demo page locally and preview your new icon.
- Open a pull request against
develop
.
To run the demo site locally or make updates to the page you'll need to do the following.
Note: these instructions assume you have NodeJS and NPM installed on your computer.
- Run
npm install
in your terminal to install the necessary dependencies. - Type
npm run start
to build a fresh copy of the demo site and start a local development server. - Navigate to
http://localhost:8080/
in your web browser to view the demo site.
The icons demo site is deployed using a Github pages branch. To deploy a newly updated site (e.g. when a new icon has been added), run npm run deploy
. This will build a fresh copy of the site and push it to the gh-pages
branch updating the demo site.
By default the rvt-icons.svg
sprite sheet comes with all of the Rivet icons included. If you only use a few icons in your app and want to reduce the size of your sprite sheet you can download or clone this repository and do the following:
- Clone the repository:
git clone https://github.com/indiana-university/rivet-icons.git
cd rivet-icons
and install the necessary dependenciesnpm install
- Open the
svg.config.js
file in a text editor and modify the contents of thesvgFilePaths
array. The default value is a glob of all the.svg
s in the./src/svg/
directory. Remove that value then add the paths to the individual icons that you would like to include in your custom sprite sheet. - Type
npm run build
into your terminal to run a Gulp task that will build your custom sprite sheet.
Given the following configuration, the resulting SVG bundle would:
- Only contain the four arrow icons from the Rivet icon set
- Have a file name of
rvt-icons-arrows-only.svg
- Be output to a folder called
/dist
in the root of the repository
module.exports = {
symbolFileName: 'rvt-icons-arrows-only',
svgFilePaths: [
'./src/svg/rvt-icon-arrow-up.svg',
'./src/svg/rvt-icon-arrow-right.svg',
'./src/svg/rvt-icon-arrow-down.svg',
'./src/svg/rvt-icon-arrow-left.svg'
]
};