Skip to content

Commit 50b2ba9

Browse files
Merge pull request #13 from nextbitlabs/feature/default-add-date-slide-number
Update sample slide and README
2 parents b25704b + 175aeb0 commit 50b2ba9

File tree

5 files changed

+63
-21
lines changed

5 files changed

+63
-21
lines changed

readme.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
# onepunch
2+
13
**onepunch** is a command-line interface to create PDF presentations using web technology.
24

3-
**onepunch** is designed for designers, it does not provide any default style. Designers can write CSS files and link them in the `index.html`.
5+
**onepunch** is designed for designers, it does not provide any default style.
6+
Designers can write CSS files and link them in the `index.html`.
47

58
### Prerequisites
69

7-
To use **onepunch**, you should have installed **node** and **npm** in your system. Please follow the [official instructions](https://www.npmjs.com/get-npm).
10+
To use **onepunch**, you should have installed **node** and **npm** in your system.
11+
Please follow the [official instructions](https://www.npmjs.com/get-npm).
812

913
### Install
1014

@@ -14,7 +18,8 @@ Install **onepunch** globally with the following command:
1418
$ npm install -g @nextbitlabs/onepunch
1519
```
1620

17-
Please note that onepunch makes use of [puppeteer](https://github.com/puppeteer/puppeteer/), which will download chromium. This is necessary to print the PDF file.
21+
Please note that onepunch makes use of [puppeteer](https://github.com/puppeteer/puppeteer/), which will download chromium.
22+
This is necessary to print the PDF file.
1823

1924
Update **onepunch** to the latest release with:
2025

@@ -28,7 +33,13 @@ $ npm update -g @nextbitlabs/onepunch
2833
$ onepunch init [-n directory-name]
2934
```
3035

31-
The command above creates the directory `directory-name` with all the files needed to bootstrap the presentation. The configuration file `onepunch.json` contains configuration parameters, for the moment only the presentation *width* and *height* (in pixels) are available.
36+
The command above creates the directory `directory-name` with all the files needed to bootstrap the presentation.
37+
38+
The configuration file `onepunch.json` contains configuration parameters, with the following available:
39+
- `width` and `height`, numeric: slide width and height in pixels;
40+
- `progress`, string: available `line`, to show a progress line at the bottom of the page, or `none`, to suppress it;
41+
- `date`, string: presentation date, used by tags `<span data-onepunch="date"></span>` along the presentation;
42+
- `slideNumber`, bool: whether to visualize the slide number in tags `<span data-onepunch="slide-number"></span>`.
3243

3344
### View the presentation
3445

@@ -53,19 +64,20 @@ Flag `-i` (or `--input`) specifies the HTML file to print, it defaults to "index
5364
Flag `-o` (or `--output`) specifies the name of the PDF file in output, it defaults to "index.pdf".
5465

5566
### Update
56-
57-
Update files in the `src` directory according to the latest release of **onepunch**, please note that any custom change inside directory `src` will be overwritten:
67+
Update **onepunch** to the latest release with:
5868

5969
```sh
60-
$ onepunch update
70+
$ npm update -g @nextbitlabs/onepunch
6171
```
6272

63-
The above command assumes you have installed the latest release of **onepunch**.
64-
If this is not the case, update **onepunch** to the latest release with:
73+
To align the `src` directory of a past presentation to the latest release of **onepunch**,
74+
first update **onepunch** itself with the command above, then use:
6575

6676
```sh
67-
$ npm update -g @nextbitlabs/onepunch
77+
$ onepunch update
6878
```
79+
This will make any new feature available to the current presentation.
80+
Please note that any custom change inside directory `src` will be overwritten.
6981

7082
### Create custom styles
7183

@@ -74,14 +86,14 @@ Each slide is created by means of tag `article`, for example:
7486
```html
7587
<main>
7688

77-
<!-- Slides 1 -->
89+
<!-- Slide 1 -->
7890
<article>
7991
<header>
8092
<h1>My Presentation Title</h1>
8193
</header>
8294
</article>
8395

84-
<!-- Slides 2 -->
96+
<!-- Slide 2 -->
8597
<article>
8698
<header>
8799
<h1>My Presentation Title</h1>
@@ -94,7 +106,8 @@ Each slide is created by means of tag `article`, for example:
94106
</main>
95107
```
96108

97-
As usual, designers can define CSS classes to apply custom style. For example, the following class defines a specific grid layout:
109+
As usual, designers can define CSS classes to apply custom style.
110+
For example, the following class defines a specific grid layout:
98111

99112
```css
100113
.layout-1 {

template/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<header>
1414
<h1>My Presentation</h1>
1515
</header>
16+
<footer>
17+
<span data-onepunch="date"></span> / Slide <span data-onepunch="slide-number"></span>
18+
</footer>
1619
</article>
1720

1821
</main>

template/onepunch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"width": 960,
33
"height": 600,
44
"progress": "line",
5-
"date": "",
6-
"slideNumber": false
5+
"date": "October 21, 2015",
6+
"slideNumber": true
77
}

template/readme.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
1-
Please edit file `index.html` to create your presentation.
1+
# **onepunch** presentation
22

3-
Start a local server with:
3+
### Configuration
4+
The configuration file `onepunch.json` contains configuration parameters, with the following available:
5+
- `width` and `height`, numeric: slide width and height in pixels;
6+
- `progress`, string: available `line`, to show a progress line at the bottom of the page, or `none`, to suppress it;
7+
- `date`, string: presentation date, used by tags `<span data-onepunch="date"></span>` along the presentation;
8+
- `slideNumber`, bool: whether to visualize the slide number in tags `<span data-onepunch="slide-number"></span>`.
9+
10+
### View the presentation
11+
12+
Inside the project directory, run:
413

514
```sh
6-
$ onepunch serve
15+
$ onepunch serve [-i htmlfile]
716
```
817

9-
Print the presentation in a PDF file with:
18+
The command above starts a local server and opens the browser, use the arrow keys to see the next and previous slides.
19+
Flag `-i` (or `--input`) specifies the HTML file to open, it defaults to "index.html".
20+
21+
### Print the PDF
22+
23+
Inside the project directory, run:
1024

1125
```sh
12-
$ onepunch print
26+
$ onepunch print [-i htmlfile] [-o pdffile]
1327
```
1428

15-
Update files in the `src` directory according to the latest release:
29+
Flag `-i` (or `--input`) specifies the HTML file to print, it defaults to "index.html".
30+
Flag `-o` (or `--output`) specifies the name of the PDF file in output, it defaults to "index.pdf".
31+
32+
### Update
33+
34+
To align the `src` directory of a past presentation to the latest release of **onepunch**,
35+
first update **onepunch** itself, then use:
1636

1737
```sh
1838
$ onepunch update
1939
```
40+
This will make any new feature available to the current presentation.
41+
Please note that any custom change inside directory `src` will be overwritten.

template/src/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
:root {
2+
--primary-color: #000000;
3+
}
4+
15
html, body {
26
margin: 0;
37
padding: 0;

0 commit comments

Comments
 (0)