https://github.com/mutsuntsai/gulp-vue-ssg
https://github.com/mutsuntsai/gulp-vue-ssg
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mutsuntsai/gulp-vue-ssg
- Owner: MuTsunTsai
- License: mit
- Created: 2022-02-12T06:54:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-23T09:10:28.000Z (6 months ago)
- Last Synced: 2025-02-24T08:50:24.031Z (5 months ago)
- Language: TypeScript
- Size: 578 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-vue-ssg
> Gulp plugin for Vue3 static site generation (SSG).

This plugin compiles .vue files (using [esbuild](https://www.npmjs.com/package/esbuild)) and performs static site generation for [client hydration](https://vuejs.org/guide/scaling-up/ssr.html#client-hydration).
## License
MIT © Mu-Tsun Tsai
## Install
```bash
npm install gulp-vue-ssg --save-dev
```## Usage
```javascript
import gulp from 'gulp';
import ssg from 'gulp-vue-ssg';// Or you can use any Vue3 plugin of your choice.
import esVue from 'esbuild-plugin-vue-next';export default () => gulp.src('src/index.htm')
.pipe(ssg({
appRoot: 'src/app.vue',
esbuildOptions: {
plugins: [esVue()]
},/**
* Where to inject the compiled result. Optional.
* Default value is `__VUE_SSG__`.
*/
injectTo: '__VUE_SSG__',/**
* Optional. If specify, additional operations will
* be applied to the app.
*/
appOptions: app => app.use(something),/**
* Whether DOM is needed during generation. Optional.
* Default value is `false`.
*
* In theory, SSG generation is not supposed to depend
* on DOM, but your app may depend on a package that
* throws errors if DOM is not available, and in those
* cases you can set this to true to make things work.
*
* You need to install optional dependency `jsdom` and
* `global-jsdom` to use this.
*/
useDOM: true,
}))
.pipe(gulp.dest('dist'));
```And this plugin will bundle and compile `src/app.vue` and inject the result to `__VUE_SSG__` in `src/index.htm`.