Hello fellow geek,
I came to realise, that this plugin was flawed in a couple of ways, so naturally I’ve fixed those flaws. And thus I stand here today to proudly present a new module that takes a different approach but still uses the same solution.
But before I do, I’d like to explain what
@uses is supposed to mean, why I think it’s better and how it should be applied.
@uses is an annotation I’ve been using for a while now. It allows me to keep track of what dependencies my files have easily.
How do I use it?
Here’s what it looks like:
* My file
* Some info about My file
* @author RWOverdijk
* @version 0.1.0
* @license MIT
* @uses ./my-dependency.js
* @uses ./my/other/dependency.js
// Code here...
As you can see, it unobtrusively informs the developer about the dependencies being used by this particular file. So using it is really simple: just maintain the dependencies of your file in the annotations, and you’re already doing it.
So, why is it better?
The arguments I’ve presented in my previous blog post still stand. In summary:
- It doesn’t add extra bytes
- It doesn’t force a dependency upon you
- It doesn’t use weird tags, or magic. Just an annotation.
- I adds value to your files.
Like I mentioned earlier, I made quite some improvements to the module. Here are the biggest ones.
It’s not a grunt plugin anymore
The biggest flaw was that it forced you to use gulp. There was no standalone version, or alternative for let’s say gulp.~ Useuses itself is now a standalone module that can be used via the CLI, or programmatically.
This means it can be used in grunt, gulp, or any environment for that matter.
I’ve made improvements in the file searches, sorting of dependencies and making sure there aren’t any duplicates. These improvements have made this module a lot faster.
The module does its job by utilising streams now, not buffering the entire file, for every file. This means that its memory footprint is a lot smaller.
You can find the module here: