djLint/docs/src/_utils/scripts.11ty.js

32 lines
742 B
JavaScript
Raw Normal View History

2022-01-24 15:03:25 +00:00
const esbuild = require('esbuild');
2022-01-03 22:45:58 +00:00
const generateContentHash = require('../lib/generateContentHash');
module.exports = class {
data() {
return {
2022-01-24 15:03:25 +00:00
permalink: `/static/js/${generateContentHash(
'src/static/js/**/*.js',
)}.js`,
eleventyExcludeFromCollections: true,
};
2022-01-03 22:45:58 +00:00
}
async render() {
await esbuild.build({
entryPoints: ['src/static/js/search.js'],
2022-01-24 15:03:25 +00:00
inject: [
'./src/static/js/hamburger.js',
'./src/static/js/animate.js',
'./src/static/js/modal.js',
],
2022-01-03 22:45:58 +00:00
bundle: true,
minify: true,
2022-01-24 15:03:25 +00:00
outfile: `_site/static/js/${generateContentHash(
'src/static/js/**/*.js',
)}.js`,
2022-01-03 22:45:58 +00:00
sourcemap: false,
2022-01-24 15:03:25 +00:00
target: 'es5',
});
2022-01-03 22:45:58 +00:00
}
2022-01-24 15:03:25 +00:00
};