How to use gulp-modified with gulp - typescript

I am integrating gulp-changed so that all files are not written to the console when changed. This works for my HTML files, but I am also using gulp - typescript to move my TypeScript files to JavaScript.

I am using the TypeScript workflow as suggested by Dan Wahlin here .

So, I have implemented gulp-modified in gulp-typescript like this:

var res = gulp.src(config.src)
        .pipe($.sourcemaps.init())
        .pipe($.changed(config.dest)) // <-- THIS LINE IS WHAT I ADDED
        .pipe($.typescript({
            target: config.options.target,
            module: config.options.module,
            removeComments: true
        }));

    res.dts.pipe(gulp.dest(config.dest));

    return res.js
        .pipe($.sourcemaps.write('.'))
        .pipe(gulp.dest(config.dest));

      

My object config

looks like this:

    "src": "./source/app/**/*.ts",
    "ignore": "!./source/**/*.d.ts",
    "options": {
        "target": "ES5",
        "module": "commonjs"
    },
    "lint": "prose",
    "dest": "./build/public/app"

      

However, all files are checked in when one file is changed. I even tried to move the above line .pipe($.changed(config.dest))

right before the line .pipe($.sourcemaps.write('.'))

.

No luck again.

Does anyone know how to fix this?

+3


source to share


1 answer


Your input files have a different extension than your output files. You need to use the option extension

to include gulp-changed

to find the correct files to compare:



.pipe($.changed(config.dest, {extension: '.js'}))

      

+3


source







All Articles