Last active
December 28, 2015 02:36
-
-
Save hulufei/b4023ab4753442177d42 to your computer and use it in GitHub Desktop.
webpack style/font/img loaders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm i --save-dev webpack webpack-dev-server url-loader file-loader style-loader css-loader autoprefixer-loader img-loader --save-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: './index.js', | |
output: { | |
path: __dirname + '/dist', | |
filename: 'bundle.js' | |
}, | |
modules: { | |
loaders: [ | |
{ test: /\.scss$/, loaders: ['style', 'css', 'autoprefixer', 'sass'] } | |
// `img?progressive` provide with img-loader | |
{ test: /\.(jpe?g|png|gif|svg)$/i, loader: 'url-loader?limit=10000!img?progressive=true' }, | |
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?mimetype=image/svg+xml' }, | |
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?mimetype=application/font-woff' }, | |
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?mimetype=application/font-woff' }, | |
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?mimetype=application/octet-stream' }, | |
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'}, | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment