It is not necessary to create an extension project if you simply want to customize or extend some Backgrid.js classes for your own private use; however, if you have one or more Backgrid.js components that add new features that may be generalized, you may consider packaging them up to share with the world.
A Backgrid.js extension is a directory structure that packages the necessary JS, CSS, tests, and document files.
The following is a guideline for extension development:
- There should be 1 .js file and 1 .css file. If your code base gets too large, consider breaking it into multiple extensions.
- There should be 1 .min.js file and 1 .min.css file produced for distribution.
- Your Gruntfile should emulate other extensions as closely as possible. For the most part, as long as your extension project's directory structure is the same, you can simply copy and paste the Gruntfile from other extensions and change the file names.
- You should use recess to lint your CSS file(s).
- You should follow the JS coding style defined here.
- Your .gitignore file inside the extension directory should ignore all output files.
- You should wrap your JS file in an immediately invoked anonymous function that lists out your dependencies in the parameter list. For extra credit, you can wrap the IIFE in a UMD block.
- Your extension should live under the
Backgrid.Extensionmodule. Specifically, your exported objects should have a reference under that module namespace regardless of which packaging mechanism you choose.
- You should clearly specify your dependencies in the README file if your extension relies on any libraries other than Backgrid.js and its dependencies.
- When in doubt, look at the other extensions for clues in organizing your code.