I managed to configure webpack to output CSS and JS to the appropriate subdirectories, i.e. public/asests/css and public/assets/js . However, I do not know how to do the same for images and fonts.
In other words, I want to output images to the public/assets/images folder and fonts to the public/assets/fonts folder.
Here is my webpack configuration file:
var path = require('path'); var ExtractCSS = require('extract-text-webpack-plugin'); module.exports = { context: path.resolve('private/js'), resolve: ['', '.js', '.jsx', '.es6', '.json'], entry: { homepage: './homepage' }, output: { path: path.resolve('public/assets'), publicPath: '/public/assets/', filename: 'js/[name].js' }, plugins: [ new ExtractCSS('css/[name].css') ], devServer: { contentBase: 'public' }, module: { loaders: [ { test: /\.(es6|js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader' }, { test: /\.css$/, exclude: /node_modules/, loader: ExtractCSS.extract('style-loader', 'css-loader') }, { test: /\.less$/, exclude: /node_modules/, loader: ExtractCSS.extract('style-loader', 'css-loader!less-loader') }, { test: /\.(jpg|jpeg|gif|png|woff|woff2|eot|ttf|svg)$/, exclude: /node_modules/, loader: 'url-loader?limit=1024' } ] } }
webpack
Pratik Mehta Oct 10 '15 at 21:02 2015-10-10 21:02
source share