Codd Wrench Codd Wrench - 3 months ago 7x
Node.js Question

Using gulp for insert html in js

I have two files, js

(function (Controllers) {
var DialogElement = (function () {
function DialogElement() {
this._template = "include:'Views/Dialog.html'";
return DialogElement;
Controllers.DialogElement = DialogElement;

and html

<div>Simple dialog!</div>

I want used gulp replaces variable
this._template = "include:'Views/Dialog.html'";
on the contents of the html file.

To get so:

function DialogElement() {
this._template = "<div>Simple dialog!</div>";

May be there is a plugin suitable for this?


I learned gulp-html2js and gulp-inject, but they work not as expected.

So i make your salf package and and use it as:

gulp.task('inject', function () {

and chenge controller:

this._template = "{{load path='Views/Dialog.html'}}"