grunt-usemin icon indicating copy to clipboard operation
grunt-usemin copied to clipboard

How to configure usemin to only replace the files with the revved version of the filerev task

Open Avien opened this issue 10 years ago • 7 comments

I don't want concatenation or uglification or to replace all the blocks in the html, I only want the usemin to replace the files with the revved version create by filerev task. However I still want to have the blocks defined in the html for full dist version (with uglify+concat etc...)

How is that possible? Thanks

Avien avatar Oct 19 '14 09:10 Avien

@Avien, just an idea, but have you tried not to run the *min:generated tasks ? In your task list, instead of :

 - useminPrepare
 - concat
 - cssmin
 - uglify
 - filerev
 - usemin

you do:

 - useminPrepare
 - concat:mysubtask
 - cssmin:mysubtask
 - uglify:mysubtask
 - filerev
 - usemin

where mysubtask is not generated, you should prevent block replacement.

But what do you want to achieve but replacing files with revved version? Is it a scenario where you want to build a non-minified dist version, but still be able to build a full minified revved version ?

stephanebachelier avatar Oct 25 '14 00:10 stephanebachelier

Exactly I want to build a debug able dist version which will always be deployed next to the minified version

Commenting the tasks in the build tasks alone did not work, it would still generate a minified version

Sent from my iPhone

On 25 באוק 2014, at 03:31, Stéphane Bachelier [email protected] wrote:

@Avien, just an idea, but have you tried not to run the *min:generated tasks ? In your task list, instead of :

  • useminPrepare
  • concat
  • cssmin
  • uglify
  • filerev
  • usemin you do:
  • useminPrepare
  • concat:mysubtask
  • cssmin:mysubtask
  • uglify:mysubtask
  • filerev
  • usemin where mysubtask is not generated, you should prevent block replacement.

But what do you want to achieve but replacing files with revved version? Is it a scenario where you want to build a non-minified dist version, but still be able to build a full minified revved version ?

— Reply to this email directly or view it on GitHub.

Avien avatar Oct 25 '14 11:10 Avien

@Avien in my experience I never deploy debugable version on server, except if something fails, which means that I've setup my grunt tasks to build either a full optimized (minified+revved) version or a not optimized. Is it something you can consider ? If not I will take a look at building the two version (minified and non minified) at the same time. I think it's possible. Let me know.

stephanebachelier avatar Oct 26 '14 15:10 stephanebachelier

ping @Avien

stephanebachelier avatar Nov 02 '14 20:11 stephanebachelier

Actually I managed to skip the uglification task and copy the concatenated files to the dist folder to be revved by using grunt copy I think uglification does the copy inside?

Avien avatar Nov 02 '14 21:11 Avien

@Avien I think the #487 should solve your problem in a better way. No need to have two differents workflow.

stephanebachelier avatar Nov 12 '14 23:11 stephanebachelier

@Avien I confirm the #487 should probably cover your need and but not a duplicate of #487. I add the docs tag as we should add your use case in documentation.

stephanebachelier avatar Feb 22 '15 00:02 stephanebachelier