Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Webpack assets for images
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahalwy committed Apr 7, 2016
1 parent 0356ee6 commit 8dc4630
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
build
node_modules
/node_modules
static/dist
test-results.xml
npm-debug.log
webpack-stats.json
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"bundle-loader": "~0.5.0",
"cache-manager": "^1.1.0",
"classnames": "^2.1.2",
"clean-webpack-plugin": "^0.1.8",
"compression": "^1.6.0",
"cookie-parser": "^1.3.5",
"copy-to-clipboard": "^1.0.4",
Expand All @@ -46,6 +47,7 @@
"express-state": "^1.2.0",
"express-useragent": "^0.2.0",
"extract-text-webpack-plugin": "^0.8.0",
"file-loader": "^0.8.4",
"html-webpack-plugin": "^1.4.0",
"http-proxy": "^1.13.2",
"humps": "^1.0.0",
Expand Down Expand Up @@ -90,7 +92,6 @@
"superagent": "^1.2.0",
"superagent-promise": "^1.0.3",
"url": "^0.11.0",
"file-loader": "^0.8.4",
"url-loader": "~0.5.5",
"webpack": "^1.10.3",
"webpack-isomorphic-tools": "^2.2.41",
Expand Down
7 changes: 2 additions & 5 deletions webpack-isomorphic-tools-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = {
'jpeg',
'jpg',
'png',
'gif'
'gif',
'svg'
],
parser: WebpackIsomorphicToolsPlugin.url_loader_parser
},
Expand All @@ -31,10 +32,6 @@ module.exports = {
],
parser: WebpackIsomorphicToolsPlugin.url_loader_parser
},
svg: {
extension: 'svg',
parser: WebpackIsomorphicToolsPlugin.url_loader_parser
},
// this whole "bootstrap" asset type is only used once in development mode.
// the only place it's used is the Html.js file
// where a <style/> tag is created with the contents of the
Expand Down
6 changes: 4 additions & 2 deletions webpack.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require('dotenv').config({path: (process.env.NODE_ENV || 'production') + '.env'});

var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
var webpack = require('webpack');
var CleanPlugin = require('clean-webpack-plugin');
var IsomorphicPlugin = require('webpack-isomorphic-tools/plugin')
var webpackIsomorphicToolsPlugin = new IsomorphicPlugin(require('./webpack-isomorphic-tools-configuration'));

Expand Down Expand Up @@ -57,11 +59,11 @@ module.exports = {
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" },
{ test: webpackIsomorphicToolsPlugin.regular_expression('images'), loader: 'url-loader?limit=10240' }
{ test: webpackIsomorphicToolsPlugin.regular_expression('images'), loader: 'url-loader?name=images/[name].[ext]&limit=10240' }
]
},
plugins: [
new CleanPlugin([relativeAssetsPath]),
new webpack.NoErrorsPlugin(),
new webpack.ProvidePlugin({
$: "jquery",
Expand Down

0 comments on commit 8dc4630

Please sign in to comment.