-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create documentation with vitepress
1 parent
5e75ff6
commit dd9b374
Showing
19 changed files
with
2,131 additions
and
1,079 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: docs | ||
|
||
on: | ||
# trigger deployment on push to main branch and if docs/ is updated | ||
push: | ||
branches: [main] | ||
paths: | ||
- "docs/**" | ||
# trigger deployment manually | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# fetch all commits to get last updated time or other git log info | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
# choose node.js version to use | ||
node-version: "14" | ||
|
||
# cache node_modules | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# install dependencies if the cache did not hit | ||
- name: Install dependencies | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' | ||
run: yarn --frozen-lockfile | ||
|
||
# run build script | ||
- name: Build VitePress site | ||
run: yarn docs:build | ||
|
||
# please check out the docs of the workflow for more details | ||
# @see https://github.com/crazy-max/ghaction-github-pages | ||
- name: Deploy to GitHub Pages | ||
uses: crazy-max/ghaction-github-pages@v2 | ||
with: | ||
# deploy to gh-pages branch | ||
target_branch: gh-pages | ||
# deploy the default output dir of VitePress | ||
build_dir: docs/.vitepress/dist | ||
env: | ||
# @see https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,31 @@ | ||
name: release | ||
|
||
on: | ||
# trigger release on every tag push | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# extract tag from the github ref (e.g. refs/tags/v1.2.3) | ||
- name: Set up tag meta | ||
id: meta | ||
run: | | ||
echo ::set-output name=tag::${GITHUB_REF#refs/tags/} | ||
# create a new release on github with discussion | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.meta.outputs.tag }} | ||
name: Release ${{ steps.meta.outputs.tag }} | ||
body: View [CHANGELOG.md](https://github.com/strapi-community/strapi-plugin-rest-cache/blob/main/CHANGELOG.md) for details | ||
draft: false | ||
prerelease: false | ||
discussion_category_name: announcements |
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 |
---|---|---|
|
@@ -135,4 +135,6 @@ schema.graphql | |
|
||
front-workspace.code-workspace | ||
.yarn | ||
.yarnrc | ||
.yarnrc | ||
|
||
cache |
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,59 @@ | ||
import { createRequire } from 'module' | ||
import { defineConfig } from 'vitepress' | ||
|
||
const require = createRequire(import.meta.url) | ||
const pkg = require('../../package.json') | ||
|
||
export default defineConfig({ | ||
title: "Local Image Sharp", | ||
description: "Dynamically resize, format and optimize images based on url modifiers.", | ||
base: "/strapi-plugin-local-image-sharp/", | ||
lastUpdated: true, | ||
themeConfig: { | ||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/strapi-community/strapi-plugin-local-image-sharp' }, | ||
], | ||
editLink: { | ||
pattern: 'https://github.com/strapi-community/strapi-plugin-local-image-sharp/edit/main/docs/:path', | ||
text: 'Edit this page on GitHub' | ||
}, | ||
logo: { | ||
src: "/icon.png", | ||
}, | ||
outline: [2,3], | ||
footer: { | ||
message: 'Made with ❤️ by <a href="https://github.com/strapi-community/">Strapi Community</a>' | ||
}, | ||
nav: [ | ||
{ | ||
text: "Guide", | ||
link: "/guide/", | ||
activeMatch: '/guide/', | ||
}, | ||
{ | ||
text: pkg.version, | ||
items: [ | ||
{ | ||
text: 'Changelog', | ||
link: 'https://github.com/strapi-community/strapi-plugin-local-image-sharp/blob/main/CHANGELOG.md' | ||
}, | ||
{ | ||
text: 'Strapi Community', | ||
link: 'https://github.com/strapi-community' | ||
} | ||
] | ||
} | ||
], | ||
sidebar: { | ||
'/guide/': [ | ||
{ | ||
text: 'Guide', | ||
items: [ | ||
{ text: 'Quick Start Guide', link: '/guide/' }, | ||
{ text: 'Modifiers', link: '/guide/modifiers' }, | ||
] | ||
}, | ||
], | ||
} | ||
} | ||
}) |
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,37 @@ | ||
<script setup> | ||
import { useData } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
import Giscus from '@giscus/vue' | ||
const { isDark } = useData() | ||
const { Layout } = DefaultTheme | ||
</script> | ||
|
||
<template> | ||
<Layout> | ||
<template #doc-after> | ||
<div class="comments"> | ||
<Giscus | ||
repo="strapi-community/strapi-plugin-local-image-sharp" | ||
repo-id="R_kgDOHHhI1w" | ||
category="Documentation" | ||
category-id="DIC_kwDOHHhI184CTblQ" | ||
mapping="pathname" | ||
strict="0" | ||
reactions-enabled="1" | ||
emit-metadata="0" | ||
input-position="bottom" | ||
:theme="isDark ? 'transparent_dark' : 'light'" | ||
lang="en" | ||
loading="lazy" | ||
/> | ||
</div> | ||
</template> | ||
</Layout> | ||
</template> | ||
|
||
<style scoped> | ||
.comments { | ||
margin-top: 2rem; | ||
} | ||
</style> |
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,7 @@ | ||
:root { | ||
--vp-c-brand: #8e75ff; | ||
--vp-c-brand-light: #a091ed; | ||
--vp-c-brand-lighter: #a091ed; | ||
--vp-c-brand-dark: #8e75ff; | ||
--vp-c-brand-darker: #8e75ff; | ||
} |
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,10 @@ | ||
import DefaultTheme from 'vitepress/theme' | ||
import Layout from './Layout.vue' | ||
import './custom.css' | ||
|
||
export default { | ||
...DefaultTheme, | ||
// override the Layout with a wrapper component that | ||
// injects the slots | ||
Layout | ||
} |
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,59 @@ | ||
--- | ||
title: Quick Start Guide | ||
--- | ||
|
||
# Quick Start Guide | ||
|
||
Convert any uploaded images with local provider using sharp modifier. | ||
No extra configuration needed, the modifiers will be applied based on the url. | ||
|
||
> This is made using [ipx](https://github.com/unjs/ipx) | ||
To install this plugin, run the following command in your Strapi project: | ||
|
||
```bash | ||
yarn add strapi-plugin-local-image-sharp | ||
``` | ||
|
||
## Usage | ||
|
||
This plugin works by setting modifiers either the path, or in the query string parameters. | ||
|
||
- Original image: | ||
`http://localhost:1337/uploads/buffalo_56442f4096.png` | ||
- WebP (Path modifier): | ||
`http://localhost:1337/uploads/format_webp/buffalo_56442f4096.png` | ||
- WebP (Query parameters): | ||
`http://localhost:1337/uploads/buffalo_56442f4096.png?format=webp` | ||
|
||
|
||
|
||
### Using path modifiers | ||
|
||
Change format to `webp` and keep other things same as source: | ||
|
||
`http://localhost:1337/uploads/f_webp/buffalo_56442f4096.png` | ||
|
||
Keep original format `png` and set width to `200`: | ||
|
||
`http://localhost:1337/uploads/w_200/buffalo_56442f4096.png` | ||
|
||
You can combine modifiers using a coma, for example: | ||
Resize to `200x200px` using `embed` method and change format to `webp`: | ||
|
||
`http://localhost:1337/uploads/embed,f_webp,s_200x200/buffalo_56442f4096.png` | ||
|
||
### Using query parameters modifiers | ||
|
||
Change format to `webp` and keep other things same as source: | ||
|
||
`http://localhost:1337/uploads/buffalo_56442f4096.png?format=webp` | ||
|
||
Keep original format `png` and set width to `200`: | ||
|
||
`http://localhost:1337/uploads/buffalo_56442f4096.png?width=200` | ||
|
||
You can combine modifiers using a coma, for example: | ||
Resize to `200x200px` using `embed` method and change format to `webp`: | ||
|
||
`http://localhost:1337/uploads/buffalo_56442f4096.png?format=webp&resize=200x200&embed` |
Oops, something went wrong.