-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable multi-framework support
- Loading branch information
Showing
47 changed files
with
505 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Official Plugins | ||
|
||
- Nuxt 3 [@histoire/plugin-nuxt](https://github.com/histoire-dev/histoire/tree/main/packages/histoire-plugin-nuxt) | ||
- Visual regression testing with Percy [@histoire/plugin-percy](https://github.com/histoire-dev/histoire/tree/main/packages/histoire-plugin-percy) | ||
- Visual regression testing (simple) [@histoire/plugin-screenshot](https://github.com/histoire-dev/histoire/tree/main/packages/histoire-plugin-screenshot) | ||
- [@histoire/plugin-vue](https://github.com/histoire-dev/histoire/tree/main/packages/histoire-plugin-vue): Vue 3 (support plugin) | ||
- [@histoire/plugin-nuxt](https://github.com/histoire-dev/histoire/tree/main/packages/histoire-plugin-nuxt): Nuxt 3 | ||
- [@histoire/plugin-percy](https://github.com/histoire-dev/histoire/tree/main/packages/histoire-plugin-percy): Visual regression testing with Percy | ||
- [@histoire/plugin-screenshot](https://github.com/histoire-dev/histoire/tree/main/packages/histoire-plugin-screenshot): Visual regression testing (simple) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<script setup> | ||
function playAudio () { | ||
document.querySelector('#histoire-audio').play() | ||
} | ||
</script> | ||
|
||
<audio id="histoire-audio"> | ||
<source src="/histoire.mp3" type="audio/mpeg"> | ||
</audio> | ||
|
||
# Getting started with Histoire | ||
|
||
## Overview | ||
|
||
> Histoire is the French word for "Story" and is pronounced `/is.twaʁ/`, like "is·twar" <button class="btn p-1 leading-none" v-on:click="playAudio"><Icon icon="carbon:volume-up-filled" class="w-4 h-4 align-middle"/></button> | ||
Histoire is a tool to generate stories applications (or "books"). | ||
|
||
[Learn more about Histoire here »](../index.md) | ||
|
||
<DemoLinks /> | ||
|
||
## Sponsors | ||
|
||
Histoire is an Open-Source project supported by our sponsors - thank you! | ||
|
||
<div class="flex justify-center mt-6 mb-12 gap-2"> | ||
<SponsorButton/> | ||
<a | ||
href="./index.html#sponsors" | ||
class="px-4 py-2 btn inline-flex items-center gap-2 !font-normal" | ||
> | ||
See our sponsors » | ||
</a> | ||
</div> | ||
|
||
## Installation | ||
|
||
Install the `histoire` and `@histoire/plugin-vue` packages into your project: | ||
|
||
```shell | ||
pnpm i -D histoire @histoire/plugin-vue | ||
# OR | ||
npm i -D histoire @histoire/plugin-vue | ||
# OR | ||
yarn add -D histoire @histoire/plugin-vue | ||
``` | ||
|
||
Create an `histoire.config.js` or `histoire.config.ts` file in your project root to enable the Vue plugin: | ||
|
||
```ts | ||
import { defineConfig } from 'histoire' | ||
import { HstVue } from '@histoire/plugin-vue' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
HstVue(), | ||
], | ||
}) | ||
``` | ||
|
||
## Command Line Interface | ||
|
||
Histoire provides two commands: | ||
- `histoire dev`: starts a development server with hot-reload | ||
- `histoire build`: builds the app for production | ||
- `histoire preview`: starts an HTTP server that serves the built app | ||
|
||
You can add these to your `package.json` like this: | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"story:dev": "histoire dev", | ||
"story:build": "histoire build", | ||
"story:preview": "histoire preview" | ||
} | ||
} | ||
``` | ||
|
||
And then run them with `npm run story:dev` or `npm run story:build`. | ||
|
||
You can specify additional CLI options like `--port`. For a full list of CLI options, run `npx histoire --help` in your project. | ||
|
||
## TypeScript | ||
|
||
To enable the global components types in your project, create an `env.d.ts` file at the root of your project if it doesn't already exist. | ||
|
||
```ts | ||
/// <reference types="@histoire/plugin-vue/components" /> | ||
``` | ||
|
||
And add it in the `include` field of your `tsconfig.json`. | ||
|
||
Example: | ||
|
||
```json | ||
{ | ||
"compilerOptions": { | ||
"target": "es2017", | ||
"module": "esnext", | ||
"lib": ["esnext"], | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"resolveJsonModule": true, | ||
"jsx": "preserve" | ||
}, | ||
"include": [ | ||
"env.d.ts", | ||
"src/**/*", | ||
"src/**/*.vue" | ||
] | ||
} | ||
``` | ||
|
||
## Nuxt | ||
|
||
Histoire supports Nuxt 3 with the `@histoire/plugin-nuxt` package. | ||
|
||
```bash | ||
pnpm add -D @histoire/plugin-nuxt | ||
``` | ||
|
||
Add the plugin in histoire config: | ||
|
||
```js | ||
import { defineConfig } from 'histoire' | ||
import { HstVue } from '@histoire/plugin-vue' | ||
import { HstNuxt } from '@histoire/plugin-nuxt' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
HstVue(), | ||
HstNuxt(), | ||
], | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { defineConfig } from 'histoire' | ||
import { HstVue } from '@histoire/plugin-vue' | ||
import { HstNuxt } from '@histoire/plugin-nuxt' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
HstVue(), | ||
HstNuxt(), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'histoire' | ||
import { HstVue } from '@histoire/plugin-vue' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
HstVue(), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'histoire' | ||
import { HstVue } from '@histoire/plugin-vue' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
HstVue(), | ||
], | ||
}) |
Oops, something went wrong.