Buffalo v0.9.5 Released!
Please read through the notes to see what is new, what has been improved, and most importantly, what might be breaking changes for existing applications.
In addition to what is listed here, I recommend you read the CHANGELOG for a complete list of what has changed in v0.9.5
.
How to Upgrade
# download the libraries
$ go get -u -v github.com/gobuffalo/buffalo/...
What’s New
Asset Fingerprinting
New Buffalo applications are now generated with Webpack configurations for finger printing assets. This is a technique used to aid in the caching of assets, as well as breaking those caches when assets have changed.
This works by generating a hash of a files contents and adding it to the name of the file: /assets/application.a8adff90f4c6d47529c4.css
. Because of this you can now no longer use paths like /assets/application.css
in your templates.
There are now three new helpers to help when dealing with assets.
The first two helpers: stylesheetTag("application.css")
, and javascriptTag("application.js")
will generate the appropriate CSS and JavaScript include tags, as well as find the correct file on disk.
The third helper, assetPath("images/foo.jpg")
, can be used to find the path of a particular asset.
NOTE: Existing applications may need to set an AssetsBox
in their actions/render.go
file in the render.Options
, if assets are not rendering properly. It is recommended to move the one from the actions/app.go
file into there instead. This will not setup asset finger printing, but will make sure the assets render correctly. See changes https://github.com/gobuffalo/gobuffalo/commit/00673ab3446a9a7209bbd243e4594bd679c81a69#diff-c1ebdbddf205da1687721a8acd29043cR43 and https://github.com/gobuffalo/gobuffalo/commit/00673ab3446a9a7209bbd243e4594bd679c81a69#diff-25015af78e14806bd828e39a29a403fbR13 for examples.
Binary Compression
Buffalo apps that have static files embedded in them, such as templates, migrations, and assets, now have those files Gzip’d inside of the final binary. This has show significant reductions in the size of the file binary.
Deprecations
As we march forward to v1.0
, and our next “major” release, v0.10.0
, it was necessary to deprecate a few methods.
- Both
buffalo.Automatic
andbuffalo.Standard
have been deprecated in favor ofbuffalo.New
. Since no one was usingbuffalo.Standard
it was decided to make things easier and move to just one initialization mechanism sobuffalo.Automatic
has becomebuffalo.New
. - The
github.com/gobuffalo/buffalo/middleware.CSRF
middleware has been deprecated in favor ofgithub.com/gobuffalo/buffalo/middleware/csrf.New
instead. - The
github.com/gobuffalo/buffalo/middleware.SessionSaver
middleware has been deprecated. Instead this functionality has been baked directly into Buffalo.
Improved Pop Transaction Middleware
Previously when using the github.com/gobuffalo/buffalo/middleware.PopTransaction
middleware the transaction would only be rolled back if an error
was returned. Now, in addition to an error
any non-successful status code (`<200 || ≥ 400`) will cause the transaction to be rolled back.
Are you a company looking for Buffalo or Go training? The Gopher Guides want to help. With customizable onsite and virtual training, the Guides will bring your team up to speed quickly, and with the knowledge they need to write great code on a daily basis.