Skip to content

Commit cea539e

Browse files
committed
fix conflicts
2 parents c227ecc + d77dca9 commit cea539e

File tree

5 files changed

+480
-5
lines changed

5 files changed

+480
-5
lines changed

README.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ReactJS based Presentation Library
1111
<!-- MarkdownTOC depth=4 autolink=true bracket=round autoanchor=true -->
1212

1313
- [Getting Started](#getting-started)
14+
- [One Page](#one-page)
1415
- [Development](#development)
1516
- [Build & Deployment](#build--deployment)
1617
- [Presenting](#presenting)
@@ -60,10 +61,95 @@ The best way to get started is by using the [Spectacle Boilerplate](https://gith
6061

6162
Alternatively, you can `npm install spectacle` and write your own build configurations. We also provide full UMD builds (with a `Spectacle` global variable) of the library at `dist/spectacle.js` and `dist/spectacle.min.js` for more general use cases. You could, for example, include the library via a script tag with: `https://unpkg.com/spectacle@VERSION/dist/spectacle.min.js`.
6263

63-
Note that we have webpack externals for `react`, `react-dom`, and `prop-types`, so you will need to provide them in your upstream build or something like linking in via `script` tages in your HTML page for all three libraries. This comports with our project dependencies which place these three libraries in `peerDependencies`.
64+
Note that we have webpack externals for `react`, `react-dom`, and `prop-types`, so you will need to provide them in your upstream build or something like linking in via `script` tags in your HTML page for all three libraries. This comports with our project dependencies which place these three libraries in `peerDependencies`.
6465

6566
But really, it is SO much easier to just use the boilerplate. Trust me.
6667

68+
<a name="one-page"></a>
69+
## One Page
70+
71+
To aid with speedy development / kicking the tires on spectacle, we suuport using a simple boilerplate HTML page with a bespoke script tag that contains your entire presentation. The rest of the setup will take care of transpiling your React/ESnext code, providing Spectacle, React, and ReactDOM libraries, and being raring to go with a minimum of effort.
72+
73+
We can start with this projet's sample at [`one-page.html`](./one-page.html). It's essentially, the same presentation as the fully-built-from-source version, with a few notable exceptions:
74+
75+
1. There are no `import`s or `require`s. Everything must come from the global namespace. This includes `Spectacle`, `React`, `ReactDOM` and all the Spectacle exports from [`./src/index.js`](./src/index.js) -- `Deck`, `Slide`, `themes`, etc.
76+
2. The presentation must include exaclty **one** script tag with the type `text/spectacle` that is a function. Presently, that function is directly inserted inline into a wrapper code boilerplate as a React Component `render` function. The wrapper is transpiled. There should not be any extraneous content around it like outer variables or comments.
77+
78+
**Good** examples:
79+
80+
```html
81+
<script type="text/spectacle">
82+
() => (
83+
<Deck>{/* SLIDES */}</Deck>
84+
)
85+
</script>
86+
```
87+
88+
```html
89+
<script type="text/spectacle">
90+
() => {
91+
// Code-y code stuff in JS...
92+
93+
return (
94+
<Deck>{/* SLIDES */}</Deck>
95+
);
96+
}
97+
</script>
98+
```
99+
100+
**Bad** examples of what not to do:
101+
102+
```html
103+
<script type="text/spectacle">
104+
// Outer comment (BAD)
105+
const outerVariable = "BAD";
106+
107+
() => (
108+
<Deck>{/* SLIDES */}</Deck>
109+
)
110+
</script>
111+
```
112+
113+
... with those guidelines in mind, here's the boilerplate that you can literally copy-and-paste into an HTML file and start a Spectacle presentation that works from the get go!
114+
115+
```html
116+
<!DOCTYPE html>
117+
<html lang="en">
118+
<head>
119+
<meta charset="UTF-8">
120+
<meta name="viewport" content="width=device-width initial-scale=1 user-scalable=no" />
121+
<title>Spectacle</title>
122+
<link href="https://fonts.googleapis.com/css?family=Lobster+Two:400,700" rel="stylesheet" type="text/css">
123+
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700" rel="stylesheet" type="text/css">
124+
<link href="https://unpkg.com/prismjs@1/themes/prism-tomorrow.css" rel="stylesheet" type="text/css">
125+
<link href="https://unpkg.com/normalize.css@7/normalize.css" rel="stylesheet" type="text/css">
126+
<link href="https://unpkg.com/spectacle/lib/themes/default/index.css" rel="stylesheet" type="text/css">
127+
</head>
128+
<body>
129+
<div id="root"></div>
130+
<script src="https://unpkg.com/prismjs@1/prism.js"></script>
131+
<script src="https://unpkg.com/prismjs@1/components/prism-jsx.min.js"></script>
132+
<script src="https://unpkg.com/prop-types@15/prop-types.js"></script>
133+
<script src="https://unpkg.com/react@15/dist/react.js"></script>
134+
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>
135+
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
136+
<script src="https://unpkg.com/spectacle/dist/spectacle.js"></script>
137+
<script src="https://unpkg.com/spectacle/lib/one-page.js"></script>
138+
<script type="text/spectacle">
139+
() => {
140+
// Your JS Code goes here
141+
142+
return (
143+
<Deck>
144+
{/* Throw in some slides here! */}
145+
</Deck>
146+
);
147+
}
148+
</script>
149+
</body>
150+
</html>
151+
```
152+
67153
<a name="development"></a>
68154
## Development
69155

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<title>Spectacle</title>
77
<link href="https://fonts.googleapis.com/css?family=Lobster+Two:400,700" rel="stylesheet" type="text/css">
88
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700" rel="stylesheet" type="text/css">
9-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/prism/1.3.0/themes/prism-tomorrow.css">
9+
<link href="https://unpkg.com/prismjs@1/themes/prism-tomorrow.css" rel="stylesheet" type="text/css">
1010
</head>
1111
<body>
1212
<div id="root"></div>
13-
<script src="https://cdn.jsdelivr.net/prism/1.3.0/prism.js" type="text/javascript"></script>
14-
<script src="https://cdn.jsdelivr.net/prism/1.3.0/components/prism-jsx.min.js" type="text/javascript"></script>
13+
<script src="https://unpkg.com/prismjs@1/prism.js"></script>
14+
<script src="https://unpkg.com/prismjs@1/components/prism-jsx.min.js"></script>
1515
<script src="./dist/bundle.js"></script>
1616
</body>
1717
</html>

0 commit comments

Comments
 (0)