yeoman / grunt-usemin

[UNMAINTAINED] Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views)
BSD 2-Clause "Simplified" License
1.22k stars 339 forks source link

async defer trouble with AngularJS reCaptcha #621

Open scne opened 8 years ago

scne commented 8 years ago

As you can see in README of https://github.com/VividCortex/angular-recaptcha I need to use

async defer in my code but when I use the grunt task useminPrepare with this conf

module.exports = { html: ['src/index.html','src/material.html'], options: { dest: 'angular' } }

and with this general task

... gtx.alias('build:angular', [ 'recess:less', 'clean:angular', 'copy:libs', 'copy:angular', 'useminPrepare', 'concat:generated', 'cssmin:generated', 'uglify:generated', 'usemin', 'clean:tmp' ]); .....

I get this error message

Running "useminPrepare:html" (useminPrepare) task Verifying property useminPrepare.html exists in config...OK Files: src/index.html -> html Options: dest="angular" Going through src/index.html to update the config Looking for build script HTML comment blocks Warning: Error: You are not supposed to mix deferred and non-deferred scripts in one block. Use --force to continue.

jeudywr commented 7 years ago

Did you ever solve this? I'm having the same issue because I added defer to a couple of script declarations to improve my score on the Pagespeed tools from Google, but after adding defer keep getting the error (and --force skips the replacement of this element).