Skip to content

Commit d532c17

Browse files
committed
Improve readme.
1 parent 37e2f7b commit d532c17

File tree

1 file changed

+70
-2
lines changed

1 file changed

+70
-2
lines changed

README.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
# `preact-boilerplate`
1+
# Preact Boilerplate / Starter Kit
22

3-
> Ready-to-go [webpack]-powered [Preact] starter project.
3+
> :guitar: Ready-to-rock [webpack]-powered [Preact] starter project.
4+
>
5+
> :rocket: If you're starting a new project using [Preact], you've come to the right place.
6+
> Below is a step-by-step guide that takes you straight from downloading this boilerplate to production.
7+
>
8+
> - [Installation](#installation)
9+
> - [Development Workflow](#development-workflow)
10+
> - [Structure](#structure)
11+
> - [Handling URLS](#handling-urls)
12+
> - [License](#license)
413
514

615
## Installation
@@ -12,30 +21,89 @@ git clone [email protected]:developit/preact-boilerplate.git my-app
1221
cd my-app
1322
```
1423

24+
1525
**2. Make it your own:**
1626

1727
```sh
1828
rm -rf .git && git init && npm init
1929
```
2030

31+
> :information_source: This re-initializes the repo and sets up your NPM project.
32+
33+
2134
**3. Install the dependencies:**
2235

2336
```sh
2437
npm install
2538
```
2639

40+
> You're done installing! Now let's get started developing.
41+
42+
43+
44+
## Development Workflow
45+
46+
2747
**4. Start a live-reload development server:**
2848

2949
```sh
3050
PORT=8080 npm run dev
3151
```
3252

53+
> This is a full web server nicely suited to your project. Any time you make changes within the `src` directory, it will rebuild and even refresh your browser.
54+
55+
3356
**5. Generate a production build in `./build`:**
3457

3558
```sh
3659
npm run build
3760
```
3861

62+
You can now deploy the contents of the `build` directory to production!
63+
64+
> **Example:** deploy to [surge.sh](https://surge.sh):
65+
>
66+
> `surge ./build -d my-app.surge.sh`
67+
68+
69+
---
70+
71+
72+
## Structure
73+
74+
Apps are built up from simple units of functionality called Components. A Component is responsible for rendering a small part of an application, given some input data called `props`, generally passed in as attributes in JSX. A component can be as simple as:
75+
76+
```js
77+
class Link extends Component {
78+
render({ to, children }) {
79+
return <a href={ to }>{ children }</a>;
80+
}
81+
}
82+
// usage:
83+
<Link to="/">Home</Link>
84+
```
85+
86+
87+
88+
## Handling URLS
89+
90+
:information_desk_person: This project contains a basic two-page app with [URL routing](http://git.io/preact-router).
91+
92+
Pages are just regular components that get mounted when you navigate to a certain URL. Any URL parameters get passed to the component as `props`.
93+
94+
Defining what component(s) to load for a given URL is easy and declarative. You can even mix-and-match URL parameters and normal props.
95+
96+
```js
97+
<Router>
98+
<A path="/" />
99+
<B path="/b" id="42" />
100+
<C path="/c/:id" />
101+
</Router>
102+
```
103+
104+
105+
---
106+
39107

40108
## License
41109

0 commit comments

Comments
 (0)