-
Notifications
You must be signed in to change notification settings - Fork 18
Getting Started
This documentation is designed to let you quickly start exploring and developing web applications with the Github.js library.
-
Create a project folder
myapp
. -
Create
index.html
file in the project folder.(leave it empty, we'll add content later) -
Download the underscore.js library from here. Create a folder named
underscore
. Then, save the file asunderscore.min.js
inunderscore
folder.
[Note: Use the production version for improving performance.]
-
Unzip the zip file
github-js-master.zip
in the project folder. -
Rename the unziped folder to
github-js
. -
Now, you should have folder structure like this:
myapp/
|
|---index.html
|
|---github-js/
| |---.gitignore
| |---bower.json
| |---Gruntfile.js
| |---LICENSE
| |---package.json
| |---README.md
| |
| |---dist/
| | |---github.min.css
| | |---github.min.js
| |
| |---src/
| |---github.css
| |---github.js
|
|---underscore/
|---underscore-min.js
Copy the HTML below to link index.html
with the library.
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<!-- Adding CSS stylesheet -->
<link rel="stylesheet" type="text/css" href="github-js/dist/github.min.css">
</head>
<body>
<div id="myProfile">
</div>
<!-- Adding underscore.js dependency -->
<script type="text/javascript" src="underscore/underscore-min.js"></script>
<!-- Adding github.js library -->
<script type="text/javascript" src="github-js/dist/github.min.js"></script>
</body>
</html>
Get the widgets using the below JavaScript code.
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<!-- Adding CSS stylesheet -->
<link rel="stylesheet" type="text/css" href="github-js/dist/github.min.css">
</head>
<body>
<div id="myProfile">
</div>
<!-- Adding underscore.js dependency -->
<script type="text/javascript" src="underscore/underscore-min.js"></script>
<!-- Adding github.js library -->
<script type="text/javascript" src="github-js/dist/github.min.js"></script>
<!-- Using library functions -->
<script type="text/javascript">
Github.userActivity({
username: 'akshaykumar6',
selector: '#myProfile'
});
</script>
</body>
</html>
You can style the #myProfile
div as per your requirement. Refer the documentation for more functions.