Skip to content

Instantly share code, notes, and snippets.

@alihesari
Last active January 18, 2018 06:58
Show Gist options
  • Save alihesari/7741388936d77baedd3f08f5b87a2362 to your computer and use it in GitHub Desktop.
Save alihesari/7741388936d77baedd3f08f5b87a2362 to your computer and use it in GitHub Desktop.
This web pack config convert assets file (images and fonts) to base64
var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: './src/js/main.js',
output: {
path: path.resolve(__dirname, 'dist/'),
publicPath: 'dist/',
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
// minimize: true
}
},
{
loader: 'sass-loader'
},
]
})
},
{
test: /\.(png|jpg|jpeg|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000',
}
]
},
plugins: [
new ExtractTextPlugin('[name].css', { allChunks: true }),
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment