Built-in JavaScript and CSS with webpack

I use Webpack to bind resources. It currently merges CSS and JS files into a separate file called bundle.js. How can I make inline inline JS and CSS in html file?

import HtmlWebpackPlugin from 'html-webpack-plugin'; import {HotModuleReplacementPlugin} from 'webpack'; export default { entry: {app: './test/dev'}, module: { loaders: [ {test: /\.js/, loader: 'babel-loader', exclude: /node_modules/}, {test: /\.scss$/, loader: 'style!css!sass'} ] }, plugins: [new HotModuleReplacementPlugin(), new HtmlWebpackPlugin()], devtool: 'eval-source-map' }; 
+5
source share
1 answer

use https://github.com/DustinJackson/html-webpack-inline-source-plugin

 plugins: [ new HtmlWebpackPlugin({ inlineSource: '.(js|css)$' // embed all javascript and css inline }), new HtmlWebpackInlineSourcePlugin() ] 
+1
source

All Articles