Codd Wrench Codd Wrench - 1 year ago 134
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?

Answer Source

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'}}"  
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download