Question

I'm using AngularJS in one of my projects. In addition to the core angular.js file, I have several AngularJS components listed in my HTML, all served from Google Hosted Libraries:

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular-touch.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular-route.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular-animate.js"></script>

AngularJS is updated very frequently, which is great. What's not great is manually editing the version number for every URL with every update.

Is there a way to update all these version numbers with a single command?

It would be amazing if the solution could update, not only Angular, but jQuery and other CDN components.

I'm adopting Bower and Grunt in my project; if these tools can help, I'd very much like to know.

Était-ce utile?

La solution

If you will be in sync with the last version of the project you can use:

jQuery latest: http://code.jquery.com/jquery-latest.min.js

Angular: http://code.angularjs.org/snapshot/angular.min.js

...

Google CDN doesn't implement this latest feature.

If you want to update versions by yourself you can use a template render in your grunt build process. https://www.npmjs.org/package/grunt-mustache-render for example. Keep a config file with versions per library and a template with your file and the gaps to be rendered in the html file.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top