代码之家  ›  专栏  ›  技术社区  ›  Muthukumar Marichamy

angular native seed,Live sync在windows 10中不工作

  •  1
  • Muthukumar Marichamy  · 技术社区  · 8 年前

    在我的原生脚本项目中,我使用了angular原生种子。除了实时同步,其他一切都正常工作。git hub在问题列表下也提出了同样的问题,但任何人都无法解决。

    每当文件更改时,都会调用gulp watch,但无法从src文件夹覆盖app文件夹(请参阅下面提到的url线程中的最后注释)。

    URL: enter link description here

    Gulpfile。js公司

    gulp.task('tns.Livesync', () => {
    return gulp.watch([`../${SRC}**/*.common.ts`, `../${SRC}**/*.tns.ts`, `../${SRC}**/*.tns.html`,  `../${SRC}**/*.service.ts`,
     `../${SRC}**/*.tns.scss`, `../${SRC}**/*.scss`, `../${SRC}**/*.component.ts`, `../${SRC}**/*.routes.ts`,
     `../${SRC}**/*.index.ts`])
        .on('change', (file) => {
            var outputDest = file.substring(0, file.lastIndexOf('\\')+1).replace(SRC.substring(0, SRC.length - 1), DEST).replace('..\\', '');
            console.log('File-->' + file);
            console.log('Des-->' + outputDest);
            gulp.src([file])
                .pipe(rename(removeTns))
                .pipe(replace('.scss\'', '.css\'', { logs: { enabled: true }}))
                .pipe(debug({title: 'tns.Livesync'}))
                .pipe(debug({title: 'out ' + outputDest}))
                .pipe(gulp.dest(outputDest, {overwrite: true}));
        });
    

    });

    有人帮我吗?

    1 回复  |  直到 8 年前
        1
  •  2
  •   Daniel Simanovitch    8 年前

    这项工作对我来说:

    gulp.task('tns.Livesync', () => {
        return gulp.watch([`../${SRC}**/*.common.ts`, `../${SRC}**/*.tns.ts`, `../${SRC}**/*.tns.html`,  `../${SRC}**/*.service.ts`,
         `../${SRC}**/*.tns.scss`, `../${SRC}**/*.scss`, `../${SRC}**/*.component.ts`, `../${SRC}**/*.routes.ts`,
         `../${SRC}**/*.index.ts`])
            .on('change', (file) => {
                var outputDest = file.substring(0, file.lastIndexOf('\\')+1).replace('src\\', 'app\\').replace('..\\', '');
                gulp.src([file])
                    .pipe(rename((path) => { path.dirname = ''; }))
                    .pipe(rename(removeTns))
                    .pipe(replace('.scss\'', '.css\'', { logs: { enabled: true }}))
                    .pipe(debug({title: 'tns.Livesync'}))
                    .pipe(debug({title: 'out ' + outputDest}))
                    .pipe(gulp.dest(outputDest, {overwrite: true}));
            });
    });
    
    推荐文章