> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/javascript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/javascript/gulp-watch-ok.md).

# \[GULP] Gulp - Watch (ok)

> Chú ý: Để kết hợp được các task với nhau từ phiên bản 4.x trở đi chúng ta phải
>
> gulp.task('default', gulp.series('css','js'));
>
> Chú ý: Nếu thì sử dụng &#x20;
>
> ```
> gulp.task('default', gulp.series('a', 'b', 'c'));
> ```
>
> Thì sử dụng
>
> ```
> gulp.task('default', gulp.parallel('a', 'b', 'c'));
> ```

Phương pháp Watch được sử dụng để giám sát các tệp nguồn của bạn. Khi bất kỳ thay đổi nào đối với tệp nguồn được thực hiện, đồng hồ sẽ chạy một tác vụ thích hợp. Bạn có thể sử dụng tác vụ 'mặc định' để theo dõi các thay đổi đối với tệp HTML, CSS và JavaScript.

### Update Default Task

Trong chương trước, bạn đã học cách kết hợp các tác vụ bằng cách sử dụng tác vụ mặc định. Chúng tôi đã sử dụng gulp-minify-css, gulp-autoprefixer và gulp-concatplugins, đồng thời tạo tác vụ styles để giảm thiểu các tệp CSS.

Để xem tệp CSS, chúng tôi cần cập nhật tác vụ ‘mặc định’ như được hiển thị trong mã sau:

```
gulp.task('default', ['styles'], function() {
   // watch for CSS changes
   gulp.watch('src/styles/*.css', function() {
      // run styles upon changes
      gulp.run('styles');
   });
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://javascriptuse.gitbook.io/javascript/gulp-watch-ok.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
