當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript gulp-watch類代碼示例

本文整理匯總了TypeScript中gulp-watch的典型用法代碼示例。如果您正苦於以下問題:TypeScript gulp-watch類的具體用法?TypeScript gulp-watch怎麽用?TypeScript gulp-watch使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了gulp-watch類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: e2eWatch

function e2eWatch(componentName: string, componentTest: string) {
  // If any tests change within components then run e2e.resources.
  watch([
    'src/components/*/test/**/*'
  ],
    function (file) {
      console.log('start e2e.resources - ' + JSON.stringify(file.history, null, 2));
      start('e2e.copyAndCompile');
    });

  // If any src files change except for tests then transpile only the source ionic files
  watch([
    'src/**/*.ts',
    '!src/components/*/test/**/*',
    '!src/util/test/*'
  ],
    function (file) {
      console.log('start e2e.ngcSource - ' + JSON.stringify(file.history, null, 2));
      start('e2e.copyAndCompile');
    });

  // If any scss files change then recompile all sass
  watch(['src/**/*.scss'], (file) => {
    console.log('start sass - ' + JSON.stringify(file.history, null, 2));
    start('e2e.sass');
  });

  console.log(`http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${E2E_NAME}/components/${componentName}/test/${componentTest}/`);

  start('e2e.serve');
}
開發者ID:JackMj,項目名稱:ionic,代碼行數:31,代碼來源:e2e.prod.ts

示例2: e2eWatch

function e2eWatch(componentName: string, componentTest: string) {
  const webpack = require('webpack');
  const WebpackDevServer = require('webpack-dev-server');
  const config = require('../../e2e/webpack.config.js');

  config.output.path = join(__dirname, '../../../');
  config.entry = {
    'dist/e2e/vendor': './scripts/e2e/vendor',
    'dist-e2e/polyfills': './scripts/e2e/polyfills'
  };
  config.entry[`./dist/e2e/components/${componentName}/test/${componentTest}/index`] = `./dist/e2e/components/${componentName}/test/${componentTest}/entry`;

  const compiler = webpack(config);

  // If any tests change within components then run e2e.resources.
  watch([
    'src/components/*/test/**/*'
  ],
  function(file) {
    console.log('start e2e.resources - ' + JSON.stringify(file.history, null, 2));
    start('e2e.copyAndCompile');
  });

  // If any src files change except for tests then transpile only the source ionic files
  watch([
    'src/**/*.ts',
    '!src/components/*/test/**/*',
    '!src/util/test/*'
  ],
  function(file) {
    console.log('start e2e.ngcSource - ' + JSON.stringify(file.history, null, 2));
    start('e2e.copyAndCompile');
  });

  // If any scss files change then recompile all sass
  watch(['src/**/*.scss'], (file) => {
    console.log('start sass - ' + JSON.stringify(file.history, null, 2));
    start('e2e.sass');
  });

  new WebpackDevServer(compiler, {
    noInfo: true,
    quiet: false,
    watchOptions: {
      aggregateTimeout: 2000,
      poll: 1000
    }
  }).listen(LOCAL_SERVER_PORT, 'localhost', function(err) {
    if (err) {
      throw err;
    }
    console.log(`http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${E2E_NAME}/components/${componentName}/test/${componentTest}/`);
  });
}
開發者ID:dioxmio,項目名稱:ionic,代碼行數:54,代碼來源:e2e.ts

示例3: function

task('e2e.watch', ['e2e'], function () {
  watchTask('e2e.bundle');

  watch('src/components/*/test/**/*', function (file) {
    start('e2e.build');
  });
});
開發者ID:fsdn,項目名稱:ionic,代碼行數:7,代碼來源:e2e.dev.ts

示例4: gulpWatch

let watchPath = (p) => {
  gulpWatch(
    p,
    {
      read: false, // performance optimization: do not read actual file contents
      verbose: true
    },
    (vinyl) => processChange(vinyl));
};
開發者ID:Resounding,項目名稱:Jobs-Web,代碼行數:9,代碼來源:watch.ts

示例5: concatApp

export default async function (env: string, target: string) {
  watch([
    `./src/${target}/**/*.html`,
    '!./src/index.html'
  ], async function(event) {
    minHtml(target).on('end', () => {
      gutil.log(gutil.colors.green('minHtml complete'))
    })
  })

  watch(['./.tmp/scripts/**/*.js'], async function (event) {
    await concatApp(env, target)
    gutil.log(gutil.colors.blue('concat complete'))
  })

  watch([
    './src/less/*.less',
    './src/components/**/*.less',
    `src/${target}/**/*less`
  ], (event) => {
    less(target)
  })

  watch('./src/components/et/**/*.html', async function (event) {
    await et()
    gutil.log(gutil.colors.cyan('et compile complete'))
  })

  watch('./src/**/*.ts', (event) => {
    lint()
  })
  .on('error', function (error) {
    gutil.log(error)
    this.emit('end')
  })

  return await webpack(env, target, true, async function (resolve) {
    gutil.log(gutil.colors.yellow('webpack complete'))
    await concatApp(env, target)
    gutil.log(gutil.colors.cyan('concat app complete'))
    resolve()
  })

}
開發者ID:jianxc,項目名稱:teambition-mobile-web,代碼行數:44,代碼來源:watch.ts

示例6:

gulp.task('build', () => {
    var files = [
        'app/**/*.ts',
        'lib/**/*.ts',
        'components/**/*.ts',
    ];

    gulp.src(files, { base: '..' })
        .pipe(watch(files, { base: '..' }));
});
開發者ID:0815fox,項目名稱:DefinitelyTyped,代碼行數:10,代碼來源:gulp-watch-tests.ts

示例7: watchTask

function watchTask(task) {
  watch([
    'src/**/*.ts',
    '!src/components/*/test/**/*',
    '!src/util/test/*'
  ],
    function (file) {
      if (file.event !== 'unlink') {
        start(task);
      }
    }
  );

  watch('src/**/*.scss', function () {
    start('e2e.sass');
  });

  start('e2e.serve');
}
開發者ID:fsdn,項目名稱:ionic,代碼行數:19,代碼來源:e2e.dev.ts

示例8: demosWatch

function demosWatch(componentName: string, componentTest: string) {
  // If any tests change within components then run demos.resources.
  watch([
    'demos/src/**/*'
  ],
    function (file) {
      console.log('start demos.resources - ' + JSON.stringify(file.history, null, 2));
      start('demos.copyAndCompile');
    });

  // If any src files change except for tests then transpile only the source ionic files
  watch([
    'src/**/*.ts',
    '!src/components/*/test/**/*',
    '!src/util/test/*'
  ],
    function (file) {
      console.log('start demos.ngcSource - ' + JSON.stringify(file.history, null, 2));
      start('demos.copyAndCompile');
    });

  // If any scss files change then recompile all sass
  watch(['src/**/*.scss'], (file) => {
    console.log('start sass - ' + JSON.stringify(file.history, null, 2));
    start('demos.sass');
  });

  let serverUrl = `http://localhost:${LOCAL_SERVER_PORT}/${DIST_NAME}/${DEMOS_NAME}`;
  if (componentName) {
    serverUrl += `/${componentName}`;
  }

  console.log(serverUrl);

  start('demos.serve');
}
開發者ID:BossKing,項目名稱:ionic,代碼行數:36,代碼來源:demos.prod.ts

示例9: gulpWatch

let watch = (callback?) => {
  watchCallback = callback || watchCallback;
  return gulpWatch(
    Object.keys(watches),
    {
      read: false, // performance optimization: do not read actual file contents
      verbose: true
    },
    (vinyl) => {
      if (vinyl.path && vinyl.cwd && vinyl.path.startsWith(vinyl.cwd)) {
        let pathToAdd = vinyl.path.substr(vinyl.cwd.length + 1);
        log(`Watcher: Adding path ${pathToAdd} to pending build changes...`);
        pendingRefreshPaths.push(pathToAdd);
        refresh();
      }
    });
};
開發者ID:reyno-uk,項目名稱:cli,代碼行數:17,代碼來源:watch.ts


注:本文中的gulp-watch類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。