taptapship / wiredep

Wire Bower dependencies to your source code.
MIT License
1.15k stars 142 forks source link

Option to include scripts with async or defer attribute #141

Closed alippai closed 9 years ago

alippai commented 9 years ago

There is no option to include the scripts with async or defer attributes. https://github.com/taptapship/wiredep/blob/1d416df3620a3dc9e13a36240a80df855fae895d/lib/default-file-types.js#L15

We should be able to pass these options with the bower comment parameters.

CWSpear commented 9 years ago

Sure there is. In your config:

html: {
  replace: {
    js: '<script defer src="{{filePath}}"></script>'
  }
},
alippai commented 9 years ago

Nice one! Thank you.

jorgecasar commented 9 years ago

The full config code to make it works, and don't have to read lines of code to get it ;)

grunt.initConfig({
  […]
  wiredep: {
    app: {
      […]
      fileTypes: {
        html: {
          replace: {
            js: '<script defer src="{{filePath}}"></script>'
          }
        }
      }
    }
  }
  […]
});

Thanks,