mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
feat: add initial OG data and improve genrator system
This commit is contained in:
@@ -14,18 +14,9 @@ const withLatex = (nextConfig = {}) => {
|
||||
use: [{
|
||||
loader: require.resolve('./webpack.js'),
|
||||
options: {
|
||||
|
||||
publicPath: `${nextConfig.assetPrefix || nextConfig.basePath || ''}/_next/static/images/`,
|
||||
outputPath: `${outputPath}static/images/`,
|
||||
name: (name) => {
|
||||
const fileName = path.basename(name);
|
||||
const parts = fileName.split('.');
|
||||
parts.pop();
|
||||
const ext = parts.pop();
|
||||
|
||||
return `${parts.join('.')}.[hash].${ext}`;
|
||||
},
|
||||
esModule: nextConfig.esModule || false,
|
||||
isDev: dev,
|
||||
publicPath: `${nextConfig.assetPrefix || nextConfig.basePath || ''}/_next/static/assets/`,
|
||||
outputPath: `${outputPath}static/assets/`,
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
@@ -12,11 +12,18 @@ module.exports = function (source) {
|
||||
const location = this.resourcePath;
|
||||
const definition = yaml.parse(source);
|
||||
const options = this.getOptions();
|
||||
generate(definition, location)
|
||||
generate({
|
||||
definition,
|
||||
location,
|
||||
isDev: options.isDev,
|
||||
addDependency: this.addDependency
|
||||
})
|
||||
.then((output) => {
|
||||
const files = Object.entries(output).reduce((output, [key, value]) => {
|
||||
const { name, content } = value;
|
||||
const targetName = loaderUtils.interpolateName(this, `[contenthash]/${name}`, {content: content});
|
||||
const { name, content, isStatic } = value;
|
||||
const targetName = isStatic
|
||||
? `${isStatic}/${name}`
|
||||
: loaderUtils.interpolateName(this, `[contenthash]/${name}`, {content: content});
|
||||
const location = path.join(options.outputPath, targetName);
|
||||
const publicPath = path.join(options.publicPath, targetName);
|
||||
this.emitFile(location, content);
|
||||
|
||||
Reference in New Issue
Block a user