neric
neric

Reputation: 4221

What does Grunt's task cdnify does and do I need it?

I have an angular app generated with yeoman. I'm trying to speed up the Grunt build so I took a closer look at the output:

Execution Time (2017-01-19 12:36:43 UTC+1)
loading tasks             319ms  ▇▇▇ 1%
wiredep:app               342ms  ▇▇▇ 2%
concurrent:test           618ms  ▇▇▇▇▇ 3%
concurrent:dist            1.7s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 8%
concat:generated          236ms  ▇▇ 1%
ngAnnotate:dist              1s  ▇▇▇▇▇▇▇▇▇ 5%
copy:dist                 331ms  ▇▇▇ 2%
loading grunt-google-cdn   1.7s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 8%
cdnify:dist                7.6s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 36%
cssmin:generated          358ms  ▇▇▇ 2%
uglify:generated           5.3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25%
Total 21.3s

Clearly cdnify:dist is taking most of the time so I looked up what the task does and realized it's replacing local urls with CDN ones.

Now that should mean that my app now needs an internet connection to work, but that does not seem to be the case. (I don't want outside world dependency as I am developing for internet less servers)

I also tried commenting out the task and the app still appear to work fine. So I am confused about what it does and would like to remove it for good once I know more about it.

Edit: That's how the task is declared in my Grunt file:

// Replace Google CDN references
cdnify: {
  dist: {
    html: ['<%= yeoman.dist %>/*.html']
  }
},

The comment adds to my confusion...

Upvotes: 0

Views: 919

Answers (1)

Gianmarco
Gianmarco

Reputation: 2552

Cdnify is useful to replace what you are using as dependency in your html code (the actual dependency that you would also be handling with bower) with the CDN version.

CDN as you might know is the Content Delivery Network and makes that dependencies available in a reliable location.

I'm of the idea that if you don't know precisely why to use something that means that you may don't need that feature.

You can of course remove that task and let your local version of the dependencies do the work, that will work fine if you don't have storage limit.

Upvotes: 1

Related Questions