Creating references to files and directories can be quite useful in various circumstances, most notably when we'd like to distribute duplicates of a file and keep them up to date without having to manually copy them after each change.
The functionality of creating symbolic links is provided to us by the contrib-symlink
(0.3.0)
plugin. It's a very simple plugin but provides all the standard Grunt configuration options.
In this example, we'll work with the basic project structure we created in the Installing Grunt on a project recipe in Chapter 1, Getting Started with Grunt. Be sure to refer to it if you are not yet familiar with its contents.
The following steps will take us through creating a symbolic link to a file named assets/img/logo.png
inside the www/img
directory.
We'll start by installing the package that contains the
contrib-symlink
plugin as per the instructions provided in the Installing a plugin recipe in Chapter 1, Getting Started...