Skip to content

Commit a36d7f0

Browse files
authored
* refactor(docs): Add midding files
1 parent d999119 commit a36d7f0

11 files changed

+168
-128
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The best way to build the fastest Angular apps. Scully is a static site generato
66

77
- [Getting Started](docs/getting-started.md)
88
- [Full Documentation](docs/scully.md)
9+
- [Live Demo](https://www.youtube.com/watch?v=Sh37rIUL-d4) (_from Dec 16, 2019_)
910

1011
# What is Scully?
1112
Scully pre-renders each page in your app to plain HTML & CSS. To do this, Scully uses machine learning techniques to find

docs/CODE_OF_CONDUCT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Code of Conduct
2+
3+
This will be prepared before we end the alpha phase of our development.

docs/blog.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Scully w/ Blogs
2+
3+
Scully is your best friend when you want to move you blog to Angular!
4+
5+
We have a schematic that will add the necessary pieces to your project to enable blogging with markdown files in your
6+
Angular app.
7+
8+
1. [Adding Blog Support](#adding-blog-support)
9+
2. [Generating New Blog Posts](#generating-new-blog-posts)
10+
11+
## Adding Blog Support
12+
13+
To add blog support to your app, run the following command:
14+
15+
```bash
16+
ng g @scullyio/init:blog
17+
```
18+
19+
This will add the blog components/modules/routes to your Angular app, as well as a folder for your blog markdown files.
20+
If you don't want the folder to be called 'blog', you can run a longer command to provide your own custom names/folders.
21+
22+
To name your blog folders and components another name, run the following command with your own name:
23+
24+
```bash
25+
ng g @scullyio/init:markdown --name=cooking
26+
```
27+
28+
## Generating New Blog Posts
29+
30+
To add a new blog post, run the following command. T
31+
32+
```
33+
ng g @scullyio/init:post --title
34+
```
35+
36+
---
37+
Next: [Full Documentation ➡️](scully.md)

docs/getting-started.md

Lines changed: 36 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,63 @@
11
# Scully - Getting Started
22

3-
After created your Angular application go to your command line using Angular-CLI, you need to add Scully to your project:
3+
The first thing you need to get started with Scully is a working Angular app using Angular 8.* or 9.*.
44

5-
```bash
6-
ng add @scullyio/init
7-
```
5+
This getting started doc covers the three steps to adding Scully into your project.
86

9-
The command above set up the necessary to start to work with Scully (_we go to get more deep about this in next releases._).
7+
1. [Installation](#installation)
8+
2. [Build](#build)
9+
3. [Test](#test)
1010

11-
If the installation was success you can read a message similar to this one.
1211

12+
## Installation
13+
To install Scully, do the following: From the root directory of your Angular project (in a terminal window), run the following command:
1314
```bash
14-
Installed packages for tooling via yarn.
15-
✔ Added dependency
16-
✔ Import HttpClientModule into root module
17-
UPDATE package.json (1447 bytes)
18-
UPDATE src/app/app.module.ts (472 bytes)
19-
UPDATE src/polyfills.ts (3035 bytes)
20-
UPDATE src/app/app.component.ts (325 bytes)
21-
✔ Packages installed successfully.
22-
✔ Update package.json
23-
CREATE scully.config.js (65 bytes)
24-
UPDATE package.json (1507 bytes)
25-
```
26-
27-
## @scullyio/init:blog
28-
29-
Scully have built-in schematics to use, `@scullyio/init:blog` allows you to create a full Lazy Loaded feature module to start your basic
30-
static site.
31-
32-
You just need write in your command line:
33-
34-
```bash
35-
ng g @scullyio/init:blog
36-
```
37-
38-
After the execution, you should read:
39-
```
40-
CREATE src/app/blog/blog-routing.module.ts (336 bytes)
41-
CREATE src/app/blog/blog.module.ts (335 bytes)
42-
CREATE src/app/blog/blog.component.css (0 bytes)
43-
CREATE src/app/blog/blog.component.html (19 bytes)
44-
CREATE src/app/blog/blog.component.spec.ts (614 bytes)
45-
CREATE src/app/blog/blog.component.ts (261 bytes)
46-
UPDATE src/app/app-routing.module.ts (336 bytes)
47-
✔ Blog 12-13-2019-blog-X file created
48-
✔ Update scully.config.js
49-
CREATE blog/12-13-2019-blog-X.md (101 bytes)
50-
UPDATE scully.config.js (121 bytes)
51-
```
52-
53-
As you can see above `ng g @scullyio/init:blog` creates the following files for you:
54-
55-
- blog-routing.module.ts
56-
- blog.module.ts
57-
- blog.component.css
58-
- blog.component.html
59-
- blog.component.spec.ts
60-
- blog.component.ts
61-
62-
Also, it updated the `app-routing.module.ts` with the new module added. Last but not least we added `scully.config.js` and create a
63-
folder named `/blog` wich inside have a markdown file.
64-
65-
###### `scully.config.js`
66-
67-
Inside this file, we can find all the routes of your app generated automatically from Scully.
68-
69-
```js
70-
exports.config = {
71-
projectRoot: "./src/app",
72-
routes: {
73-
'/blog/:slug': {
74-
type: 'contentFolder'
75-
},
76-
}
77-
};
15+
ng add @scullyio/init
7816
```
7917

80-
##### What if I don't want a module called "blog"?
18+
At this point, Scully has been added to your project. The most important part of the installation is the addition of the
19+
Scully configuration file: `scully.config.js` (_soon this will be `scully.config.ts`_). To learn more about this file,
20+
read [Scully Configuration](scully-configuration.md) docs.
8121

82-
If for any reason you want to customize the name of your module we have a specific command for that.
22+
## Build
8323

84-
## @scullyio/init:markdown --name
85-
86-
With `@scullyio/init:markdown` you can customize the name of your modules easy, just adding the flag `--name`
24+
So you have your Angular app AND you have installed Scully. So let's run a scully build to turn your site into a
25+
pre-rendered Angular app. Because scully runs based on a build of your app, the first step is to build your Angular
26+
project. Then you can run the scully build.
8727

8828
```bash
89-
ng g @scullyio/init:markdown --name=categories
29+
ng build
30+
npm run scully
9031
```
9132

92-
The example above allows you to create a new Lazy Loaded Module named "categories".
93-
33+
That's it. You're done! In your project directory, you now have a `/dist/static` folder that contains the built version
34+
of your app.
9435

95-
## ng g @scullyio/init:post --title
36+
__NOTE:__ If you had any errors or warning during the build phase, please follow the instructions in the errors/warnings
37+
(if applicable) or [submit an issue](issues).
9638

97-
PENDING
39+
## Test
9840

99-
```
100-
ng g @scullyio/init:post --title
101-
```
41+
Now that you're project has been pre-rendered, you can validate the build in one of a few ways.
10242

103-
### Time to build!
43+
1. Serve the contents of your `dist/static` directory
44+
2. Browse the contents of `dist/static` directory and read the HTML
10445

105-
At this moment we know how to create our static site using Scully, but now it's time to build and see the magic.
46+
#### Serve the contents
10647

107-
#### Step one, build our angular app
48+
Using something like [http-server](https://www.npmjs.com/package/http-server) you can serve the contents of your
49+
`dist/static` folder. All routes that work in your non-pre-rendered Angular app should still work. Not all apps are
50+
capable of running without
10851

109-
We need to build our Angular app using the command:
52+
__Extra Credit__: While serving your app, [disable javasript](https://developers.google.com/web/tools/chrome-devtools/javascript/disable)
53+
and make sure that you app still works. This is the goal for your app, to run with JavaScript disabled. Most of the
54+
parts of your app should work without JS enabled.
11055

111-
```bash
112-
ng build
113-
```
114-
115-
After finished this process the Angular-CLI should create the dist folder with all our fully compiled app.
116-
117-
#### Step two, build using Scully
118-
119-
```bash
120-
npm run scully
121-
```
122-
123-
As a result of command line above inside the `dist` folder we should found another 2 folder:
124-
125-
```
126-
|-- dist/
127-
| |-- my-project-name/
128-
| |-- static/
56+
#### Browse the contents
12957

130-
```
58+
Browse the contents of your `dist/static` directory and make sure that all of your pages were pre-rendered and saved to
59+
HTML correctly.
13160

132-
`static` folder contains all our static site ready for deploy to your favorite server.
133-
13461

13562
---
136-
Prev: [Pre-requisites ⬅️️](pre-requisites.md) | Next: [Working with Plugins ➡️](working-with-plugins.md)
63+
Next: [Full Documentation ➡️](scully.md)

docs/issues.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Scully Issues
2+
3+
Better documentation will be added for creating issues.

docs/plugins.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Plugins
2+
3+
Scully uses a plugin system to allow users to define new ways for Scully to build your app. There are two main types of
4+
plugins:
5+
6+
1. [Route Plugins](#route-plugins)
7+
2. [Data Transform Plugins](#transform-plugins)
8+
9+
See our [Recommended Plugins](recommended-plugins.md) page to find a list of available plugins.
10+
11+
## <a name="route-plugins"></a> Route Plugins
12+
13+
Scully needs __Route Plugins__ to discover data needed to pre-render your app's views. Any route that has a route
14+
parameter in it will require you to configure a plugin that teaches Scully how to get the data needed for those route
15+
parameters.
16+
17+
Let's look at an example. Suppose your app has a route `{path: 'user/:userId', component: UserComponent}`. In order for
18+
Scully to pre-render your app, it needs to know the complete list of User IDs that will be used in that route parameter
19+
`:userId`. If your app had 5 users with the IDs 1, 2, 3, 4, and 5, then Scully would need to render the following routes:
20+
```
21+
/user/10
22+
/user/11
23+
/user/12
24+
/user/13
25+
/user/14
26+
```
27+
28+
To provide this list of User IDs to Scully, you'll use a __Route Plugins__.
29+
30+
The following is an example that uses the [jsonplaceholder](https://jsonplaceholder.typicode.com/) to fetch a list of
31+
User IDs for my app.
32+
33+
```javascript
34+
// scully.config.js
35+
exports.config = {
36+
// Add the following to your file
37+
routes: {
38+
"/user/:userId": {
39+
"type": "json",
40+
"userId": {
41+
"url": "https://jsonplaceholder.typicode.com/users",
42+
"property": "id"
43+
}
44+
}
45+
}
46+
};
47+
```
48+
49+
The above snippet tells Scully that when it sees a route that matches `/user/:userId` it should use the `json` plugin
50+
to fetch some JSON via HTTP. After declaring the type of `json`, the above example has a key `userId`. The value for
51+
`userId` contains two pieces of data. First, the url that the JSON plugin should go to to get this required JSON. The
52+
second is `property`. The JSON plugin will pluck the provided property name from each of the items in the array. This
53+
means that the array returned by the jsonplaceholder api will each have an `id` property. So instead of returning a list
54+
users, it will return a list of userIds.
55+
56+
57+
## <a name="transform-plugins"></a> Data Transform Plugins
58+
59+
Describe data transform plugins

docs/pre-requisites.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Scully - Pre-Requisites
22

33

4-
Before you start building awesome sites with **Scully**, you'll need to familiarized and understand how some web technologies works.
4+
Before you start building awesome sites with **Scully**, you will need to understand how some web technologies work.
55

66
- Command Line Interface (CLI)
77
- GIT
88
- Node
99

10-
Those 3 topics are very important to start to use Scully successfully.
10+
Those 3 topics are very important to successfully start using Scully .
1111

12-
### Software tools to be able to work with Scully are:
12+
### Software tools needed to work with Scully are:
1313

1414
- Node 10 or higher.
1515
- Angular CLI version 9.

docs/recommended-plugins.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Community Plugins
2+
3+
The following is a list of our recommended Scully plugins.
4+
5+
_If you would like to add a plugin to this list, please submit a PR to the `docs/recommended-plugins.md`._
6+
7+
## Official Plugins
8+
9+
- `json` plugin
10+
- `content` plugin (_we will be renaming this_)
11+
12+
## Community Plugins
13+
14+
- (_be the first to submit a plugin_)

docs/scully-configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Scully Configuration
2+
3+
The center of every scully project is the `scully.config.js`. This config file must export the configuration for your
4+
scully build. Whether you need to add a

docs/scully.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@
22

33
## What is Scully?
44

5-
**Scully** is freaking awesome, Why? because we can create static sites using Angular,
5+
**Scully** is freaking awesome. Why? Because it can create static sites using Angular.
66
so basically **Scully** is a SSG (static site generator) for Angular.
77

8-
### How we can do that?
8+
### How does it do it?
99

10-
The magic happens thanks to our node CLI application. We use schematics add simpleness to the entire flow.
11-
12-
Scully works on Windows, Linux and ~~also even on~~ MacOS.
10+
The magic happens thanks to its node CLI application. It allows you to use schematics for a simple work flow.
11+
12+
Scully works on Windows, Linux and MacOS.
1313

14+
Visit one of the following topics:
1415

1516
- [Pre-requisites](pre-requisites.md)
1617
- [Getting Started](getting-started.md)
17-
- [Working with Plugins](working-with-plugins.md)
18+
- [Adding Blog Support](blog.md)
19+
- [Working with Plugins](plugins.md)
1820
- [Code of Conduct](CODE_OF_CONDUCT.md)
1921
- [Issues](issues.md)
2022

2123

22-
---
23-
Next: [Pre-requisites ➡️](pre-requisites.md)
24-

0 commit comments

Comments
 (0)