Skip to content

Commit

Permalink
feat: global components (#164)
Browse files Browse the repository at this point in the history
* feat(lib): register nuxt components:dirs hook

* chore(deps): use nuxt v2.13.x

* chore(example): use global components

* chore(docs): use global components

* docs: add section about global components

* Update docs/package.json

Co-authored-by: Sébastien Chopin <[email protected]>

* docs: update global components

* Update writing.md

* chore: remove commitlint

* docs: update deps

* chore(deps): update

* chore(github): add ci on dev branch

Co-authored-by: Sébastien Chopin <[email protected]>
  • Loading branch information
benjamincanac and atinux authored Jun 25, 2020
1 parent db9fbca commit bfeffcb
Show file tree
Hide file tree
Showing 45 changed files with 920 additions and 1,868 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- master
- dev

jobs:
ci:
Expand Down
5 changes: 0 additions & 5 deletions commitlint.config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</template>

<script>
import ClickAway from '../directives/click-away'
import ClickAway from '~/directives/click-away'
export default {
name: 'Dropdown',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<template>
<div
class="alert border-l-4 p-4 mb-4"
:class="`alert-${type}`"
>
<div class="alert border-l-4 p-4 mb-4" :class="`alert-${type}`">
<div class="flex">
<div class="flex-shrink-0 self-start pt-1">
<IconInfo v-if="type === 'info'" class="alert-icon" />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions docs/content/en/writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,20 @@ However, you cannot render
</my-component>
```

#### Global components

Since **v2.0.0** and Nuxt **v2.13.0**, you can now put your components in `components/global/` directory so you don't have to import them in your pages.

```bash
components/
global/
Hello.vue
content/
home.md
```

Then in `content/home.md`, you can use `<hello></hello>` component without having to worry about importing it in your page.

### Table of contents

A `toc` array property will be injected into your document, listing all the `h2` and `h3` with their titles and ids, so you can link to them.
Expand Down
File renamed without changes.
11 changes: 1 addition & 10 deletions docs/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export default {
'@/plugins/categories',
'@/plugins/i18n.client',
'@/plugins/vue-scrollactive',
'@/plugins/components',
'@/plugins/menu.client'
],
components: true,
/*
** Give routes to static generation
*/
Expand Down Expand Up @@ -76,15 +76,6 @@ export default {
'@nuxt/content'
],
/*
** Components auto import
** See https://github.com/nuxt/components
*/
components: {
dirs: [
{ path: '@/components', pattern: '*.vue' }
]
},
/*
** Modules configuration
*/
colorMode: {
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"lint": "eslint --ext .js,.vue --ignore-path .gitignore ."
},
"dependencies": {
"@nuxt/content": "^1.3.2",
"@nuxt/content": "nuxt/content#dev",
"@nuxtjs/pwa": "^3.0.0-beta.20",
"lodash.groupby": "^4.6.0",
"nuxt-edge": "^2.13.0-26541346.39dd866b",
"nuxt": "^2.13.1",
"nuxt-i18n": "^6.12.2",
"prism-themes": "^1.4.0",
"tailwindcss": "^1.4.6",
Expand Down
4 changes: 4 additions & 0 deletions docs/pages/_slug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export default {
}
}
.nuxt-content h4 {
@apply text-xl font-semibold mb-2 pb-1 border-b -mt-16 pt-20;
}
@screen lg {
.nuxt-content h2 a,
.nuxt-content h3 a {
Expand Down
19 changes: 0 additions & 19 deletions docs/plugins/components.js

This file was deleted.

Loading

0 comments on commit bfeffcb

Please sign in to comment.