Skip to content

Commit 2f94386

Browse files
Add blog post for 5.2 (#1119)
* Add blog post for 5.2 * Fix spacing * Clarity edits
1 parent 02e3616 commit 2f94386

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: 'ReactJS.NET 5.2'
3+
layout: post
4+
author: Dustin Masters
5+
---
6+
7+
🚀 We're pleased to announce the release of ReactJS.NET 5.2. In this release:
8+
9+
## Templates
10+
11+
This update contains a brand new feature - templates! This feature makes it much easier to get started on a new project.
12+
13+
To start a new ASP.NET Core project using React and server-side rendering:
14+
15+
```
16+
dotnet new -i React.Template
17+
dotnet new reactnet-webpack
18+
dotnet run
19+
```
20+
21+
The `reactnet-vanilla` template is also available for projects that don't need webpack.
22+
23+
## Webpack Asset Manifest Support
24+
25+
If you've ever wanted to use hashes in the filenames of generated assets, this feature is for you! When using Webpack and `webpack-manifest-plugin`, it's now possible to render the script and style tags automatically from the generated asset manifest. This can be especially helpful when using caching headers to instruct the client not to refetch these static assets from the server.
26+
27+
If using the filename pattern `'[name].[contenthash:8].js'`, webpack will emit files that look like this:
28+
29+
```
30+
vendor.8faee7f5.js
31+
main-0c14766b.js
32+
```
33+
34+
Configure reading these files server-side with `config.SetReactAppBuildPath("~/dist");` where `dist` is the directory where webpack emits the built assets.
35+
36+
In your view code, call:
37+
38+
```
39+
@Html.ReactGetStylePaths() // in the doucment head next to other stylesheets
40+
41+
@Html.ReactGetScriptPaths() // right before the body closing tag
42+
```
43+
44+
Next, define an asset manifest format in your webpack config. Check out the [sample webpack config](https://github.com/reactjs/React.NET/blob/38dfa0589ff2e96426006599047180880d1fcf31/src/React.Sample.Webpack.CoreMvc/webpack.config.js#L37-L52) for the format the asset manifest is expected to follow.
45+
46+
At render time, the asset manifest will be read from the `dist` directory and be mapped into `script` and `style` tags for the browser to download.
47+
48+
The `reactnet-webpack` sample uses this layout, so give it a try if you're curious!
49+
50+
## Thanks
51+
52+
If this library has made a difference to you in either a work or personal project, I'd love to hear from you. We don't get paid at all to work on this, it's just for fun! Drop a line [@dustinsoftware](https://twitter.com/dustinsoftware) or [@Daniel15](https://twitter.com/Daniel15)
53+
54+
Cheers,
55+
Dustin

0 commit comments

Comments
 (0)