/
outthevoid
/
frontend_developer_module_2
Обзор
Документация
Войти
/
outthevoid
/
frontend_developer_module_2
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
webpack.config/plugins/pug-plugin-module.js
31 строка
786 B
darthmorgot
Создал файл с настройками для pug-plugin
03 июл 2023, 12:10
03 июл 2023, 12:10
daeb642
Код
Авторство
О чём код?
const pathApp = require('node:path'); const path = require('../paths.js'); const PugPlugin = require('pug-plugin'); const keepPugFolderStructure = (pathData) => { const sourceFile = pathData.filename; const relativeFile = pathApp.relative(path.src, sourceFile); const {dir, name} = pathApp.parse(relativeFile); if (name === 'index') { return `${name}.html`; } else { return `${dir}/${name}.html`; } }; const pugPlugin = (mode) => { return new PugPlugin({ pretty: mode, js: { filename: mode ? 'assets/js/[name].js' : 'assets/js/[name].[contenthash:8].js', }, css: { filename: mode ? 'assets/css/[name].css' : 'assets/css/[name].[contenthash:8].css', }, filename: keepPugFolderStructure, }); }; module.exports = pugPlugin;