javascript - How to avoid multiple helper implementations like __indexOf() with grunt-contrib-coffee -


i have gruntfile.coffee has grunt-contrib-coffee configuration this:

coffee:   compile:     files:       'public/assets/application.js': [           'multiple/files' #, ...       ]     options:       bare: true 

the problem is, generates multiple implementations of helper methods like

    var __indexof = [].indexof || function(item) { (var = 0, l = this.length; < l; i++) { if (i in && this[i] === item) return i; } return -1; }; 

how make recognize these implementations compiled?

update 1

the reason compiled javascript gets concatenated after got compiled. avoided if coffeescript concatenated before compiling it. if not configuration option of grunt-contrib-coffee i'm missing, i'll submit issue on github.

so question remains is: how concatenate coffeescript before compiling it, avoid multiple helper implementations?

update 2

there workaround, involves manual concatenation of source files concat task. requires temporary file, can compiled coffeescript javascript. mentioned in issue created.

in future, tasks able pass stuff buffers each other (see issue).

as of grunt-contrib-coffee-0.6.1 works join option:

coffee:   compile:     files:       'public/assets/application.js': [           'multiple/files' #, ...       ]     options:       bare: true       join: true # concatenate coffee files before compiling. default false 

Comments

Popular posts from this blog

multithreading - Exception in Application constructor -

React Native allow user to reorder elements in a scrollview list -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -