Sometimes projects take on a life of their own, and you end up with something unexpected.
I set out to create an template for CRUD-focused single page
AngularJS web applications, something I and perhaps my colleagues could
use as a foundation for writing new applications. But under the
momentum of self-applied scope creep, what I ended up creating was a
Grunt-powered codebase library management tool, with my original
template concept as the first codebase of potentially multiple
One of the most common uses of the Grunt
task runner is to build a deployment package out of your development
code for your website or web application, and part of that build process
singular (or at least fewer) files for optimal download.
The grunt-contrib-concat Grunt plugin allows you to configure a concatenation task to target individual files or entire directories, like so:
src: [ 'dev/jquery/jquery.js', 'dev/angular/services/*.js', 'dev/angular/directives/*.js' ],
The only drawback is that you have to update the task's "src"
As I was playing around with Grunt on a personal project, I came to
wonder: could I create a Grunt task or set of tasks that could figure
out which files to concatenate based on the <link> and
<script> tags in my code? Here's what I came up with.