ludohenin / gulp-inline-ng2-template

Gulp plugin to inline HTML and CSS into Angular 2 component decorators
MIT License
126 stars 26 forks source link

Is it possible to use this plugin with tsProject.src() instead of gulp.src() #84

Open AbhilashThomas opened 7 years ago

AbhilashThomas commented 7 years ago

`var gulp = require('../node_modules/gulp');

var ts = require('../node_modules/gulp-typescript'); var tsConfigPath = './src/tsconfig.json'; var tsProject = ts.createProject(tsConfigPath); var tsResult = tsProject.src() .pipe(inlineNg2Template({ useRelativePaths: true})) .pipe(tsProject());`

With above code, the templateUrl doesn't change. Can we use tsProject.src() ?

AHelper commented 6 years ago

You can do something like

var gulp = require('../node_modules/gulp');

var ts = require('../node_modules/gulp-typescript');
var tsConfigPath = './src/tsconfig.json';
var tsProject = ts.createProject(tsConfigPath);
var tsResult = tsProject.src()
    .pipe(tsProject());
tsResult.js.pipe(inlineNg2Template({ useRelativePaths: true}))
  .pipe(gulp.dest("./"));

The last paragraph of gulp-typescript's basic usage section in the readme highlights scenarios like this.