Accepting selected projects for Q2 2024 Check availability
SERVER 02SYSTEM ONLINELAST SYNC: 03:17:44RSS_FEED.XML — PARSE WARNING
HALF ASSEDTECHNICAL NOTES_
EST. 2009ISSUE 04.2BEST VIEWED AT 1024 × 768
TECHNICAL NOTES / PRACTICAL GUIDES / DEVELOPMENT / RECORD 6e5ade
[DEVELOPMENT]GUIDE

Creating a repeatable front-end build with Grunt

POSTED: 05.09.2013AUTHOR: ADMIN9 MIN READCOMMENTS: 0

Grunt can turn a collection of manual compression and concatenation steps into a shared build. The task graph should produce the same deployable assets from a clean checkout in development and continuous integration.

Inventory the existing steps

List Sass or Less compilation, linting, concatenation, minification, image optimisation and file copying in their required order. Remove editor-specific output and decide which generated assets belong in the release.

Pin the toolchain

Declare Grunt, plugins and compatible versions in package.json, then use one documented Node.js version. Avoid globally installed plugins that allow one workstation to succeed with dependencies absent from CI.

Separate development and release tasks

Provide a fast watch task with source maps or readable output and a clean release task with minification, revisioning and error failure. Both must share the same source entry points and destination rules.

Revision cacheable assets

Generate content-based or build-specific filenames for long-lived assets and update template references from a manifest. Do not ask operators to clear every browser cache after a deployment.

Build from clean state

Delete generated directories, install declared dependencies and run the complete task in CI. Publish only produced artefacts and retain enough unminified source to diagnose production errors.

BUILD RULE

The release task must fail on missing inputs and invalid output; a warning followed by an old generated file is not a successful build.