reactjs - Specify gulp-inject Script Type -


i using jsx react. possible specify type of injected script in order use in-browser jsx transformer while working in dev mode?

<!-- inject:js --> <script type="text/jsx" src="js/components/component.js"></script> <!-- endinject --> 

gulp-inject considers jsx different type javascript. if change file suffix .jsx , use start tag inject:jsx instead of inject:js, output contains type="text/jsx" attribute.

another option (if need keep .js suffix) override default transform function:

var inject = require('gulp-inject');  inject.transform.html.js = function (path) {   return '<script type="text/jsx" src="'+path+'"></script>'; }; 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -