tiptap/docs/gridsome.config.js

98 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-03-06 18:59:36 +08:00
const path = require('path')
2020-11-22 06:09:56 +08:00
const visit = require('unist-util-visit')
2020-03-06 18:59:36 +08:00
function addStyleResource(rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/variables.scss'),
],
})
}
2020-11-22 06:09:56 +08:00
function tableWrapper() {
return async tree => {
visit(
tree,
'table',
(node, index, parent) => {
if (node.type === 'table' && parent.type === 'root') {
const original = { ...node }
node.type = 'div'
node.children = [original]
node.data = {
hProperties: {
class: 'table-wrapper',
},
}
}
},
)
}
}
2019-12-08 04:02:22 +08:00
module.exports = {
2020-10-13 02:18:18 +08:00
siteName: 'tiptap',
2020-11-06 21:20:00 +08:00
titleTemplate: '%s | tiptap',
2019-12-08 04:02:22 +08:00
port: 3000,
plugins: [
{
use: '@gridsome/vue-remark',
options: {
2020-04-18 23:05:29 +08:00
typeName: 'DocPage',
2020-04-24 16:03:15 +08:00
baseDir: './src/docPages',
2020-11-06 21:20:00 +08:00
template: './src/templates/DocPage/index.vue',
2021-01-29 21:59:05 +08:00
// index: './introduction',
2019-12-08 04:02:22 +08:00
plugins: [
'@gridsome/remark-prismjs',
2020-08-19 02:42:54 +08:00
'remark-container',
2020-09-27 16:29:01 +08:00
'remark-toc',
2020-11-22 06:09:56 +08:00
tableWrapper,
2019-12-08 04:02:22 +08:00
],
2020-04-19 05:00:47 +08:00
remark: {
autolinkHeadings: {
content: {
type: 'text',
2020-09-24 05:38:11 +08:00
value: '#',
},
},
},
2020-04-17 18:55:53 +08:00
},
2019-12-08 04:02:22 +08:00
},
{
use: 'gridsome-plugin-simple-analytics',
options: {
2020-12-14 21:41:15 +08:00
domain: 'data.next.tiptap.dev',
},
},
2021-02-03 00:23:57 +08:00
{
use: 'gridsome-plugin-plausible-analytics',
options: {
dataDomain: 'next.tiptap.dev',
},
},
2020-03-06 18:59:36 +08:00
],
2020-09-30 16:01:16 +08:00
runtimeCompiler: true,
2020-10-02 04:52:31 +08:00
configureWebpack: {
node: {
fs: 'empty',
child_process: 'empty',
tls: 'empty',
net: 'empty',
},
2020-10-02 05:58:48 +08:00
externals: {
canvas: 'commonjs canvas',
},
2020-10-02 04:52:31 +08:00
},
2020-03-06 18:59:36 +08:00
chainWebpack(config) {
// Load variables for all vue-files
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => {
addStyleResource(config.module.rule('scss').oneOf(type))
})
},
2019-12-08 04:02:22 +08:00
}