The Structure of a Plug-in

A basic Grunt plug-in consists of a tasks folder that contains one or more JavaScript files that define the tasks. These files have the exact same structure as a regular Gruntfile.

Inside of the tasks folder is a lib folder that should hold any functions or objects that do the work. In other words, your task definitions go in the main tasks folder and the logic for those tasks goes in the lib folder. If you explore the official Grunt plug-ins you’ll see that this is the structure they use. It keeps the task definitions clean and concise.

The plug-in also has a package.json folder and a Gruntfile.js file. The Gruntfile.js file has a line that loads the tasks from the tasks folder, which makes it easy to try out your plug-in.

Now that you know how plug-ins are structured, let’s build our plug-in’s core functionality.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.127.232