@silexlabs/eleventy-plugin-concat
Version:
Eleventy plugin to bundle your scripts and styles
20 lines (17 loc) • 538 B
JavaScript
const { basename } = require('path')
function fileName(ext, preprend = '') {
return page => `${ preprend }${ ext }/${ basename(page.outputPath, '.html') }-concat.${ ext }`
}
module.exports = {
input: '.',
output: '_site',
jsUrl: fileName('js', '/'),
jsPath: fileName('js'),
jsSelector: 'head script[data-concat]',
jsAttributes: 'defer',
cssUrl: fileName('css', '/'),
cssPath: fileName('css'),
cssSelector: 'head link[data-concat], head style[data-concat]',
cssAttributes: '',
baseUrl: 'http://localhost:8080',
}