Today at Jamstack_Conf, Netlify announced Build Plugins. What it does is allow you to have particular hooks for events within your build, like when the build starts or ends. What’s nice about them is that they’re just a plain ‘ol JavaScript object, so you can insert some logic or kick off a library just the way you typically would within your application.
A “Build” is when you give your site to Netlify either via GitHub/GitLab/etc., or by literally just dropping the directory into the interface, Netlify will process all the assets, download and install packages, and generate a static version of the site to deploy to CDNs all around the world.
What the Build Plugin does is give you access to key points in time during that process, for instance, onPreBuild
, onPostBuild
, onSuccess
, and so forth. You can execute some logic at those specific points in time, like this:
module.exports = {
onPreBuild: () => {
console.log('Hello world from onPreBuild event!')
},
}
You don’t only have to build them yourself, either! You can use build plugins that have been made by the community. There are very interesting ones, such as a11y, Cypress for testing, Inline Critical CSS, and my personal favorite, Subfont, which optimizes fonts for you in a really incredible way (you can watch a video about that).
Enable them through the dashboard through a few button clicks:
If you’d like to learn more, check out the announcement post here! Happy building!
The post Get Programmatic Control of your Builds with Netlify Build Plugins appeared first on CSS-Tricks.
from CSS-Tricks https://ift.tt/2zte8Oe
via IFTTT
No comments:
Post a Comment