Skip to content

Commit

Permalink
feature: css + js + measure img size (#2872)
Browse files Browse the repository at this point in the history
* new configs

* config

* naming

* updates

* font settings

* remove v1

* implement converters to typographyV2 and layout

* thread implementation

* upgrade fern-docs config

* fix docsconfigfile visitor

* reset settings

* fix error

* update snap

* fix colors and layout

* private

* add support for stream

* css and js options

* add measurement

* fix dependencies

* sharp

* remove plaiceholder for now

* fix js

* fix js

* wire up strat

* resolve path for css

* fixg

* fix yarn

* fix snap

---------

Co-authored-by: dsinghvi <[email protected]>
  • Loading branch information
abvthecity and dsinghvi authored Feb 11, 2024
1 parent ec9d6f7 commit b4748c8
Show file tree
Hide file tree
Showing 24 changed files with 461 additions and 89 deletions.
41 changes: 31 additions & 10 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,15 @@ plugins:
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.6.1.cjs

supportedArchitectures:
os:
- current
- darwin
- linux
- win32
cpu:
- current
- x64
- ia32
- arm64
88 changes: 88 additions & 0 deletions fern/apis/docs-config/definition/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ types:
layout:
type: optional<LayoutConfig>
availability: in-development
css: optional<CssConfig>
js: optional<JsConfig>

TabId: string

Expand Down Expand Up @@ -338,3 +340,89 @@ types:
properties:
url: string
text: string

CssConfig:
docs: |-
The `css` object allows you to customize the appearance of your docs site by injecting custom CSS, i.e.
```yaml
css: "path/to/css/file.css"
```
or, multiple files:
```yaml
css:
- "path/to/css/file.css"
- "path/to/another/css/file.css"
```
discriminated: false
union:
- string # path to css file
- list<string>

JsConfig:
docs: |-
The `js` object allows you to customize the behavior of your docs site by injecting custom JavaScript, i.e.
```yaml
js: "path/to/js/file.js"
```
or, multiple files:
```yaml
js:
- "path/to/js/file.js"
- "path/to/another/js/file.js"
```
or remote js:
```yaml
js:
url: "https://example.com/path/to/js/file.js"
strategy: "afterInteractive"
```
or, mixed:
```yaml
js:
- "path/to/js/file.js"
- path: "path/to/another/js/file.js"
strategy: "beforeInteractive"
- url: "https://example.com/path/to/js/file.js"
```
discriminated: false
union:
- JsConfigOptions
- list<JsConfigOptions>

JsConfigOptions:
discriminated: false
union:
- JsRemoteConfig
- JsFileConfig

JsRemoteConfig:
properties:
url: string
strategy: optional<JsScriptStrategy>

JsFileConfig:
discriminated: false
union:
- string # path to js file
- JsFileConfigSettings

JsFileConfigSettings:
properties:
path: string
strategy: optional<JsScriptStrategy>

JsScriptStrategy:
enum:
- beforeInteractive
- afterInteractive # default
- lazyOnload
5 changes: 3 additions & 2 deletions fern/docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
instances:
- url: fern.docs.buildwithfern.com
custom-domain: docs.buildwithfern.com
# - url: fern.docs.buildwithfern.com
# custom-domain: docs.buildwithfern.com
- url: fern.docs.dev.buildwithfern.com

title: Fern | Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@fern-api/fdr-sdk": "0.46.1-19-g5e3bf66",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/task-context": "workspace:*",
"@fern-fern/docs-config": "0.0.70",
"@fern-fern/docs-config": "0.0.75",
"js-yaml": "^4.1.0",
"tinycolor2": "^1.6.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ export interface ParsedDocsConfiguration {
layout: WithoutQuestionMarks<DocsV1Write.DocsLayoutConfig> | undefined;
/* filepath of page to contents */
pages: Record<RelativeFilePath, string>;
css: DocsV1Write.CssConfig | undefined;
js: JavascriptConfig | undefined;
}

export interface AbsoluteJsFileConfig {
absolutePath: AbsoluteFilePath;
strategy?: DocsV1Write.JsScriptStrategy;
}

export interface JavascriptConfig {
remote?: DocsV1Write.JsRemoteConfig[];
files: AbsoluteJsFileConfig[];
}

export interface DocsColorsConfiguration {
Expand Down
Loading

0 comments on commit b4748c8

Please sign in to comment.