2016-09-18 24 views
5

Tôi đang sử dụng Webpack để đóng gói tài nguyên. Hiện tại, nó đóng gói cả tệp CSS và JS vào một tệp riêng biệt được gọi là bundle.js. Làm thế nào tôi có thể làm cho cả hai JS và CSS nhúng nội tuyến trong tập tin html?JavaScript và CSS nội tuyến với webpack

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' 
}; 
+0

Bạn đã tìm thấy một giải pháp? –

+1

Tôi đang sử dụng grunt-processhtml https://github.com/dciccale/grunt-processhtml để giải quyết điều đó. – VJAI

Trả lời

Các vấn đề liên quan