Skip to content

Commit 8c14d39

Browse files
committed
feat: initial version with docs
Module hooks into @nuxt/components to inject loaders of these components into plugin. The NuxtDynamic component is able to load a component dynamically with those loaders.
0 parents  commit 8c14d39

24 files changed

+10122
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
*.iml
3+
.idea
4+
*.log*
5+
.nuxt
6+
.vscode
7+
.DS_Store
8+
coverage
9+
dist
10+
sw.*
11+
.env

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 blokwise
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# @blokwise/dynamic
2+
3+
Read the official [docs](https://dynamic.blokwise.io)
4+
5+
## Installation
6+
7+
Add `@blokwise/dynamic` dependency to your project:
8+
9+
```bash
10+
yarn add @blokwise/dynamic
11+
```
12+
13+
```bash
14+
npm install @blokwise/dynamic
15+
```
16+
17+
Then, add `@blokwise/dynamic` to the `modules` section of `nuxt.config.js`:
18+
19+
```js[nuxt.config.js]
20+
{
21+
modules: [
22+
'@blokwise/dynamic'
23+
],
24+
}
25+
```
26+
27+
## Usage
28+
29+
### Use dynamic component
30+
31+
The dynamic component will be loaded as `NuxtDynamic`. The component will be loaded wheter you pass the name prefix or not. So in the following case it could load a component called `Logo` without prefix or a component called `BlokwiseLogo` which is prefixed with `Blokwise` according to `@nuxt/components` configuration of your project / third party libraries.
32+
33+
```vue
34+
<template>
35+
<NuxtDynamic name="Logo" />
36+
</template>
37+
```
38+
39+
### Load the component lazily
40+
41+
The dynamic component can be loaded lazily as `LazyNuxtDynamic`.
42+
43+
```vue
44+
<template>
45+
<LazyNuxtDynamic name="Logo" />
46+
</template>
47+
```

docs/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# Create one with no scope selected on https://github.com/settings/tokens/new
3+
GITHUB_TOKEN=

docs/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
*.iml
3+
.idea
4+
*.log*
5+
.nuxt
6+
.vscode
7+
.DS_Store
8+
coverage
9+
dist
10+
sw.*
11+
.env

docs/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# @blokwise/dynamic
2+
3+
## Setup
4+
5+
Install dependencies:
6+
7+
```bash
8+
yarn install
9+
```
10+
11+
## Development
12+
13+
```bash
14+
yarn dev
15+
```
16+
17+
## Static Generation
18+
19+
This will create the `dist/` directory for publishing to static hosting:
20+
21+
```bash
22+
yarn generate
23+
```
24+
25+
To preview the static generated app, run `yarn start`
26+
27+
For detailed explanation on how things work, checkout [nuxt/content](https://content.nuxtjs.org) and [@nuxt/content theme docs](https://content.nuxtjs.org/themes-docs).

docs/content/en/index.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Introduction
3+
description: ""
4+
position: 1
5+
category: ""
6+
features:
7+
- Extends nuxt/component
8+
- Auto-loading of dynamic components
9+
---
10+
11+
<img src="/preview.png" class="light-img" width="1280" height="640" alt=""/>
12+
<img src="/preview-dark.png" class="dark-img" width="1280" height="640" alt=""/>
13+
14+
[Module]() for [NuxtJS](https://nuxtjs.org).
15+
16+
<alert type="success">
17+
Let nuxt.js hydrate your dynamic components with a breeze - automagically.
18+
</alert>
19+
20+
## Features
21+
22+
<list :items="features"></list>
23+
24+
This `nuxt.js` module only works with [`@nuxt/components`](https://www.npmjs.com/package/@nuxt/components).
25+
26+
<p class="flex items-center">Enjoy light and dark mode:&nbsp;<app-color-switcher class="inline-flex ml-2"></app-color-switcher></p>

docs/content/en/setup.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Setup
3+
description: ""
4+
position: 2
5+
category: Guide
6+
---
7+
8+
## Installation
9+
10+
Add `@blokwise/dynamic` dependency to your project:
11+
12+
<code-group>
13+
<code-block label="Yarn" active>
14+
15+
```bash
16+
yarn add @blokwise/dynamic
17+
```
18+
19+
</code-block>
20+
<code-block label="NPM">
21+
22+
```bash
23+
npm install @blokwise/dynamic
24+
```
25+
26+
</code-block>
27+
</code-group>
28+
29+
Then, add `@blokwise/dynamic` to the `modules` section of `nuxt.config.js`:
30+
31+
```js[nuxt.config.js]
32+
{
33+
modules: [
34+
'@blokwise/dynamic'
35+
],
36+
}
37+
```
38+
39+
Check the [Nuxt.js documentation](https://nuxtjs.org/guides/configuration-glossary/configuration-modules) for more information about installing and using modules in Nuxt.js.

docs/content/en/usage.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Usage
3+
description: ""
4+
position: 3
5+
category: Guide
6+
---
7+
8+
## Dynamic component
9+
10+
The dynamic component will be loaded as `NuxtDynamic`. The component will be loaded wheter you pass the name prefix or not. So in the following case it could load a component called `Logo` without prefix or a component called `BlokwiseLogo` which is prefixed with `Blokwise` according to `@nuxt/components` configuration of your project / third party libraries.
11+
12+
```vue
13+
<template>
14+
<NuxtDynamic name="Logo" />
15+
</template>
16+
```
17+
18+
## Load the component lazily
19+
20+
The dynamic component can be loaded lazily as `LazyNuxtDynamic`.
21+
22+
```vue
23+
<template>
24+
<LazyNuxtDynamic name="Logo" />
25+
</template>
26+
```

0 commit comments

Comments
 (0)