Skip to content

Commit

Permalink
#4 Update the samples according to changes in Webpack project
Browse files Browse the repository at this point in the history
  • Loading branch information
xabikos committed Jan 17, 2016
1 parent 3bdc2c8 commit e463f38
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 16 deletions.
6 changes: 3 additions & 3 deletions samples/Aspnet.Webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lorem-ipsum": "^1.0.3"
},
"devDependencies": {
"autoprefixer": "^6.2.3",
"autoprefixer": "^6.3.1",
"babel-core": "^6.4.0",
"babel-loader": "^6.2.1",
"babel-preset-es2015": "^6.3.13",
Expand All @@ -21,7 +21,7 @@
"postcss-loader": "^0.8.0",
"sass-loader": "^3.1.2",
"style-loader": "^0.13.0",
"webpack": "^1.12.10",
"webpack-dev-server": "^1.14.0"
"webpack": "^1.12.11",
"webpack-dev-server": "^1.14.1"
}
}
2 changes: 1 addition & 1 deletion samples/Aspnet.Webpack/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Webpack": "1.1.0"
"Webpack": "1.2.0"
},

"commands": {
Expand Down
9 changes: 7 additions & 2 deletions samples/AspnetReact.Webpack/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
StylesType.Sass
},
HandleJsxFiles = true,
EnableHotLoading = true,
DevServerOptions = new WebpackDevServerOptions()
HandleStaticFiles = true,
StaticFileTypesLimit = 10000,
StaticFileTypes = new List<StaticFileType> {
StaticFileType.Png,
StaticFileType.Jpg
},
EnableHotLoading = true
});
//app.UseWebpack("webpack_external/webpack.config.js", "bundle.js", new WebpackDevServerOptions());
app.UseDeveloperExceptionPage();
Expand Down
12 changes: 7 additions & 5 deletions samples/AspnetReact.Webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"name": "AspnetReact.Webpack",
"version": "0.0.0",
"devDependencies": {
"autoprefixer": "^6.2.3",
"babel-core": "^6.4.0",
"babel-loader": "^6.2.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"css-loader": "^0.23.1",
"file-loader": "^0.8.5",
"node-sass": "^3.4.2",
"postcss-loader": "^0.8.0",
"react-transform-hmr": "^1.0.1",
"sass-loader": "^3.1.2",
"style-loader": "^0.13.0",
"webpack": "^1.12.10",
"webpack-dev-server": "^1.14.0"
"url-loader": "^0.5.7",
"webpack": "^1.12.11",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"react": "^0.14.6",
Expand All @@ -24,7 +24,9 @@
"babel": {
"env": {
"development": {
"presets": ["react-hmre"]
"presets": [
"react-hmre"
]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion samples/AspnetReact.Webpack/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Webpack": "1.1.0"
"Webpack": "1.2.0"
},

"commands": {
Expand Down
17 changes: 15 additions & 2 deletions samples/AspnetReact.Webpack/reactApp/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@ import React, {Component} from 'react';
import '../styles/site.scss';

import Counter from './counter.jsx';

import smallImage from '../images/react-small.png';
import largeImage from '../images/react-large.jpg';

class App extends Component {
render() {
return (
<div>
<Counter />
<div id="small-image">
<p>
This is an example of an image which is embeded as bese 64 encoded using the url loader
</p>
<img alt="small-image" src={smallImage} />
</div>
<div id="large-image">
<p>
This is an example of a <strong>large</strong> image which is too large to base64 encoded and is just copied to output using the file loader
</p>
<img alt="large-image" src={largeImage} />
</div>
</div>
);
}
}

export default App;
export default App;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions samples/AspnetReact.Webpack/reactApp/styles/site.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$secondsColor: red;

body {
padding-top: 50px;
padding-top: 60px;
padding-bottom: 20px;
}

Expand All @@ -12,4 +12,14 @@ body {

#seconds {
background-color: $secondsColor;
}
}

#small-image{
margin: 30px 0;
}

#large-image {
img {
max-width: 1024px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ module.exports = {
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=100000'
}
]
},
Expand Down

0 comments on commit e463f38

Please sign in to comment.