egg-webpack-assets
v1.0.0
Published
egg-webpack-assets
Downloads
9
Readme
egg-webpack-assets
开启插件
// {app_root}/config/plugin.js
exports.webpackAssets = {
enable: true,
package: 'egg-webpack-assets',
};
使用场景
webpack AssetsPlugin
插件生成的json文件,在 egg
框架视图层直接使用 assets
变量。
例如:
// xx.html
{% if assets['vendor'] and assets['vendor'].css %}<link href="{{ assets['vendor'].css}}" rel="stylesheet">{% endif %}
详细配置
// {app_root}/config/config.default.js
'use strict';
const path = require('path');
module.exports = appInfo => {
return {
webpackAssets: {
file: path.join(appInfo.baseDir, 'app', 'assets.json'), // webpack AssetsPlugin插件生成的json文件路径
},
};
};