Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ GitHub Cards is available on jsdelivr now. Use widget hosted on jsdelivr:
<script src="https://cdn.jsdelivr.net/gh/lepture/github-cards@latest/jsdelivr/widget.js"></script>
```

## Building

If you want to work on this project locally, you'll first need to clone it `git clone https://github.com/lepture/github-cards`

Then you'll need to install a few build dependencies:

* [python3](https://www.python.org/) (if not already installed, through your favorite package manager)
* [npm](https://www.npmjs.com/) (through your favorite package manager, along with Node.js)
* [uglifyjs](https://www.npmjs.com/package/uglify-js) through `sudo npm install -g uglify-js`
* [cleancss](https://www.npmjs.com/package/clean-css-cli) through `sudo npm install -g clean-css-cli`

Once all of this is installed, you should be all set to build the site ! Use `make build` to do so. You can then view the site by opening _\_site/index.html_ in your browser of choice, and start making changes (you'll need to rebuild the site every time you change the files in _src/_)

## Contribution

This project is under the BSD License.
10 changes: 5 additions & 5 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def create_card(theme):

css = shell(['cleancss', 'theme/%s.css' % theme])

with open('src/card.js', 'rb') as f:
with open('src/card.js', 'r') as f:
content = f.read()
content += GA % 'UA-21475122-2'

js = shell(['uglifyjs', '-m'], content)
js = shell(['uglifyjs', '-m'], content.encode())

out = html % (css, tinyhtml(template), js)
out = html % (css.decode(), tinyhtml(template), js.decode())
with open('cards/%s.html' % theme, 'wb') as f:
f.write(out)
f.write(out.encode())


def create_widget():
Expand All @@ -71,7 +71,7 @@ def create_widget():
'var base = "%s";' % url
)

js = shell(['uglifyjs', '-m'], content)
js = shell(['uglifyjs', '-m'], content.encode())
with open('jsdelivr/widget.js', 'wb') as f:
f.write(js)

Expand Down