markblog/next.config.js
Florian Bouillon 70f05363e2
WIP
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2019-12-16 23:59:00 +01:00

41 lines
998 B
JavaScript

const withCSS = require('@zeit/next-stylus')
const glob = require('glob')
const withOffline = require('next-offline')
// import posts from './posts/pages.json.ts'
// const posts = require('./posts/pages.json.ts')
// const t = require('./pages/portfolio/')
module.exports = withOffline(withCSS({
/* config options here */
exportTrailingSlash: true,
// cssModules: true,
// target: 'serverless',
webpack: function(config) {
config.module.rules.push({
test: /\.md$/,
use: 'raw-loader'
})
return config
},
plugins: [
["styled-jsx/babel", { "optimizeForSpeed": true }]
],
exportPathMap: async function() {
const paths = {
'/': { page: '/'},
'/portfolio': { page: '/portfolio'},
}
const posts = glob.sync('./posts/**/*.md')
posts.forEach(element => {
element = element.replace(/^.*[\\\/]/, '')
.split('.')
.slice(0, -1)
.join('.')
paths[`/portfolio/${element}`] = { page: '/portfolio/[slug]', query: { slug: element}}
});
return paths
}
}))