I'm trying to use GitHub's primer and octicons. After using npm
to install both I started using the css classes defined by GitHub by including the build.css
file in my html document. How would I point the project towards all the svg icons that octicons
gives me?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello Primer</title>
<link rel="stylesheet" href="node_modules/primer-css/build/build.css">
</head>
<body>
<form>
<div class="input-group">
<input class="form-control" type="text" placeholder="Username">
<span class="input-group-button">
<button class="btn">
<span class="octicon octicon-clippy"></span>
</button>
</span>
</div>
</form>
</body>
</html>
[edit] short answer: include node_modules/octicons/build/font/octicons.css
This works, without svg icons. If you want to use the svg icons, you should probably include the images using <img>
tags. However, using a font makes this a lot easier.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello Primer</title>
<link rel="stylesheet" href="node_modules/primer-css/build/build.css">
<link rel="stylesheet" href="node_modules/octicons/build/font/octicons.css">
</head>
<body>
<form>
<div class="input-group">
<input class="form-control" type="text" placeholder="Username">
<span class="input-group-button">
<button class="btn">
<span class="octicon octicon-clippy"></span>
</button>
</span>
</div>
</form>
</body>
</html>
And if you really feel the need for it, here is an version using svg
's:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello Primer</title>
<link rel="stylesheet" href="node_modules/primer-css/build/build.css">
<link rel="stylesheet" href="node_modules/octicons/build/octicons.css">
</head>
<body>
<form>
<div class="input-group">
<input class="form-control" type="text" placeholder="Username">
<span class="input-group-button">
<button class="btn">
<span class="octicon octicon-clippy"></span>
<img src="node_modules/octicons/lib/svg/clippy.svg"></img>
</button>
</span>
</div>
</form>
</body>
</html>
Why don't we just use cdn link, or download from there?
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Primer/3.0.1/css/primer.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
Use Bower to install Octicons.
bower.json:
{
"name": "my-app",
...
"dependencies": {
"octicons": "4.3.0",
}
}
Then link to wherever your bower libraries are being held:
<link href="/libs/octicons/build/font/octicons.css" rel="stylesheet">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With