Skip to content

Commit

Permalink
docs(scully): add docs about ng-lib
Browse files Browse the repository at this point in the history
* docs(scully): add docs about ng-lib

* docs(scully): refactor ng-lib docs

* docs(scully): fix typo
  • Loading branch information
Villanuevand authored Jan 29, 2020
1 parent d0ac97a commit 4ae475e
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/scully-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export interface ScullyConfig {

`projectRoot` is reference to the path to the project where scully will intervene.

This property is **_mandatory_**, scully fill automatically post installation.
This property is **_mandatory_**, scully fill automatically post installation,

**_IMPORTANT_** this property won't be **_mandatory_** anymore in future releases.

### homeFolder

Expand Down
102 changes: 102 additions & 0 deletions docs/scully-lib-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Scully Core

## Idle Monitor

Scully implements the `IdleMonitorService` to hook into Zonejs. When angular goes idle (**more precise, when all outgoing HTTP-requests are settled**)
Scully trigger Puppeteer, and knows when it's ready to render.

Without this process, we have to resort to a (25 seconds) timeout. this is both slower and unprecise, some pages need even more time.

`IdleMonitorService` is available in `ScullyLibModule`.

## Router Service

`ScullyRoutesService` is an service to provide to the user access to certains methods and observables to know
the routes rendered by Scully.

- available\$
- unPublished\$
- topLevel\$
- getCurrent()
- reload()

The `ScullyRoutesService` use the `ScullyRoute` interface to set types.

```typescript
export interface ScullyRoute {
route: string;
title?: string;
slugs?: string[];
published?: boolean;
slug?: string;
[prop: string]: any;
}
```

#### available\$: _Observable<ScullyRoute[]>_

`available$` returns routes with the property `published` with value true.

#### unPublished\$: _Observable<ScullyRoute[]>_

`unPublished$` returns routes with the property `published` with value false.

#### topLevel\$: _Observable<ScullyRoute[]>_

`topLevel$` returns top level routes.

#### getCurrent(): _Observable<ScullyRoute>_

`getCurrent()` method returns the current location

#### reload(): _void_

`reload` method checks if new routes was added in the `scully-routes.json`.

## Scully Content

Scully use the `scully-content` to insert the result of the render process into the HTML document.

The `scully-content` component won't work inside a `*ngIf` directive.

## Transfer State

The `TransferStateService` allows transfer the state of the Angular application to the static site rendered by Scully.

To set or get the state of the application you can use 2 methods:

- getState
- setState

#### getState

`getState` will return an observable that fires once and completes. It does so right after the navigation for the page has finished.

```typescript
getState<T>(name: string): Observable<T>
```

#### setState

`setState` will set values to the property key.

```typescript
setState<T>(name: string, val: T): void
```

## Utils

#### Is Scully

- isScullyRunning()
- isScullyGenerated()

##### isScullyRunning(): _boolean_

`isScullyRunning` returns `true` or `false` if Scully build is happening.

##### isScullyGenerated(): _boolean_

`isScullyGenerated` returns `true` if Scully build has run.

[Full Documentation ➡️](scully.md)
1 change: 1 addition & 0 deletions docs/scully.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Visit one of the following topics:
- [Getting Started](getting-started.md)
- [Scully Configuration](scully-configuration.md)
- [Scully command line options](./scully-cmd-line.md)
- [Scully Core](./scully-lib-core.md)
- [Adding Blog Support](blog.md)
- [Working with Plugins](plugins.md)
- [Polyfills](polyfills.md)
Expand Down

0 comments on commit 4ae475e

Please sign in to comment.