LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • wheels generate app
        • wheels generate app-wizard
        • wheels generate controller
        • wheels generate model
        • wheels generate view
        • wheels generate property
        • wheels generate route
        • wheels generate resource
        • wheels generate api-resource
        • wheels generate frontend
        • wheels generate test
        • wheels generate snippets
        • wheels scaffold
      • Database Commands
        • wheels dbmigrate info
        • wheels dbmigrate latest
        • wheels dbmigrate up
        • wheels dbmigrate down
        • wheels dbmigrate reset
        • wheels dbmigrate exec
        • wheels dbmigrate create blank
        • wheels dbmigrate create table
        • wheels dbmigrate create column
        • wheels dbmigrate remove table
        • wheels db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • wheels deploy
        • wheels deploy audit
        • wheels deploy exec
        • wheels deploy hooks
        • wheels deploy init
        • wheels deploy lock
        • wheels deploy logs
        • wheels deploy proxy
        • wheels deploy push
        • wheels deploy rollback
        • wheels deploy secrets
        • wheels deploy setup
        • wheels deploy status
        • wheels deploy stop
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • Object Relational Mapping
    • Creating Records
    • Reading Records
    • Updating Records
    • Deleting Records
    • Column Statistics
    • Dynamic Finders
    • Getting Paginated Data
    • Associations
    • Nested Properties
    • Object Validation
    • Object Callbacks
    • Calculated Properties
    • Transactions
    • Dirty Records
    • Soft Delete
    • Automatic Time Stamps
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Arguments
  • Options
  • Examples
  • Basic file watching
  • Watch specific directory
  • Watch additional file types
  • Exclude directories
  • Auto-run tests
  • Custom debounce timing
  • Default Behavior
  • Output Example
  • Advanced Configuration
  • Performance Considerations
  • Integration with Editors
  • VS Code
  • Sublime Text
  • Common Patterns
  • Development Workflow
  • Frontend + Backend
  • Test-Driven Development
  • Troubleshooting
  • Notes
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Core Commands

wheels watch

Watch for file changes and automatically reload the application.

Synopsis

wheels watch [path] [--extensions] [--exclude] [--reload-mode]

Description

The wheels watch command monitors your application files for changes and automatically triggers actions like reloading the application or running tests. This provides a smooth development workflow with instant feedback.

Arguments

Argument
Description
Default

path

Directory to watch

. (current directory)

Options

Option
Description
Default

--extensions

File extensions to watch

.cfc,.cfm,.json

--exclude

Paths to exclude

temp/,logs/,.git/

--reload-mode

Reload mode when changes detected

development

--test

Run tests on change

false

--debounce

Milliseconds to wait before reacting

500

--help

Show help information

Examples

Basic file watching

wheels watch

Watches current directory for .cfc, .cfm, and .json changes

Watch specific directory

wheels watch ./src

Watch additional file types

wheels watch --extensions=".cfc,.cfm,.js,.css"

Exclude directories

wheels watch --exclude="node_modules/,temp/,logs/"

Auto-run tests

wheels watch --test

Custom debounce timing

wheels watch --debounce=1000

Default Behavior

When a file change is detected:

  1. CFC Files (models, controllers)

    • Triggers application reload

    • Clears relevant caches

    • Runs tests if --test enabled

  2. CFM Files (views)

    • Clears view cache

    • No full reload needed

  3. Config Files (.json, settings.cfm)

    • Full application reload

    • Re-reads configuration

Output Example

[Wheels Watch] Monitoring for changes...
[Wheels Watch] Watching: /Users/myapp
[Wheels Watch] Extensions: .cfc, .cfm, .json
[Wheels Watch] Excluded: temp/, logs/, .git/

[12:34:56] Change detected: models/User.cfc
[12:34:56] Reloading application...
[12:34:57] ✓ Application reloaded successfully

[12:35:23] Change detected: views/users/index.cfm
[12:35:23] Clearing view cache...
[12:35:23] ✓ View cache cleared

[12:36:45] Multiple changes detected:
  - controllers/Products.cfc
  - models/Product.cfc
[12:36:45] Reloading application...
[12:36:46] ✓ Application reloaded successfully
[12:36:46] Running tests...
[12:36:48] ✓ All tests passed (15 specs, 0 failures)

Advanced Configuration

Create .wheels-watch.json for project-specific settings:

{
  "extensions": [".cfc", ".cfm", ".js", ".css"],
  "exclude": ["node_modules/", "temp/", ".git/", "logs/"],
  "reload": {
    "mode": "development",
    "debounce": 500
  },
  "test": {
    "enabled": true,
    "on": ["models/", "controllers/"],
    "command": "wheels test run"
  },
  "custom": [
    {
      "pattern": "assets/",
      "command": "npm run build"
    }
  ]
}

Performance Considerations

  • Large directories may slow down watching

  • Use --exclude to skip unnecessary paths

  • Increase --debounce for grouped changes

  • Consider watching specific subdirectories

Integration with Editors

VS Code

Add to .vscode/tasks.json:

{
  "label": "Wheels Watch",
  "type": "shell",
  "command": "wheels watch",
  "problemMatcher": [],
  "isBackground": true
}

Sublime Text

Create build system:

{
  "cmd": ["wheels", "watch"],
  "working_dir": "${project_path}"
}

Common Patterns

Development Workflow

# Terminal 1: Run server
box server start

# Terminal 2: Watch for changes
wheels watch --test

Frontend + Backend

wheels watch --extensions=".cfc,.cfm,.js,.vue" \
  --custom='{"pattern":"src/","command":"npm run build"}'

Test-Driven Development

wheels watch models/ controllers/ --test --reload-mode=testing

Troubleshooting

  • Too many file descriptors: Increase system limits or exclude more directories

  • Changes not detected: Check file extensions and excluded paths

  • Slow response: Increase debounce time or watch specific directories

  • Tests failing: Ensure test environment is properly configured

Notes

  • Requires file system events support

  • Some network drives may not support watching

  • Symbolic links are followed by default

See Also

Previouswheels destroyNextCode Generation

Last updated 2 days ago

Was this helpful?

- Manual application reload

- Run tests

- Configure watch settings

wheels reload
wheels test run
wheels config set