Paulo
Paulo

Reputation: 416

Grunt usemin task to replace resources

Using GruntJS, is it possible to replace certain resources in an HTML file with a remote path (or perhaps just anypath)? I'm particularly interested in doing this with the usemin plugin.

Possible sample functionality:

Before

<!-- build:js //cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.js -->
<script src="/lib/angular.js"></script>
<!-- endbuild -->

After

<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.3/angular.js"></script>

This idea is very similar to what the usemin plugin does but it skips the concatenation of the enclosed resources into a new file of the specified name. In other words, it replaces all the enclosed HTML with a single resource of the specified path.

Upvotes: 2

Views: 2057

Answers (2)

user1746358
user1746358

Reputation: 51

grunt-applymin is an alternative project for grunt-usemin: https://github.com/ghosert/grunt-applymin

Upvotes: 1

user2589608
user2589608

Reputation: 21

I wrote grunt-dom-munger because I found usemin too specific. You can use grunt-dom-munger to alter your HTML however you see fit and also to read your script tags and send those to concat/uglify/etc.

grunt-dom-munger

Upvotes: 2

Related Questions