Repository: tailwindlabs/tailwindcss
File: packages/@tailwindcss-cli/src/commands/build/index.ts (TypeScript)

Code before:
      await outputFile(args['--output'], output)
    } else {
      println(output)
    }
  }

  let inputFile = args['--input'] && args['--input'] !== '-' ? args['--input'] : process.cwd()
  let inputBasePath = path.dirname(path.resolve(inputFile))
  let fullRebuildPaths: string[] = cssImportPaths.slice()

  function createCompiler(css: string) {
    return compile(css, {
      base: inputBasePath,
      onDependency(path) {
        fullRebuildPaths.push(path)
      },
    })
  }

  // Compile the input
  let compiler = await createCompiler(input)
  let scanner = new Scanner({
    detectSources: { base },
    sources: compiler.globs.map(({ origin, pattern }) => ({
      // Ensure the glob is relative to the input CSS file or the config file
      // where they are specified.
      base: origin ? path.dirname(path.resolve(inputBasePath, origin)) : inputBasePath,
      pattern,
    })),
  })

  // Watch for changes
  if (args['--watch']) {
    let cleanupWatchers = await createWatchers(
      watchDirectories(base, scanner),
      async function handle(files) {
        try {
          // If the only change happened to the output file, then we don't want to
          // trigger a rebuild because that will result in an infinite loop.
          if (files.length === 1 && files[0] === args['--output']) return

          let changedFiles: ChangedContent[] = []
          let rebuildStrategy: 'incremental' | 'full' = 'incremental'

          let resolvedFullRebuildPaths = fullRebuildPaths

          for (let file of files) {
            // If one of the changed files is related to the input CSS or JS
            // config/plugin files, then we need to do a full rebuild because
            // the theme might have changed.
            if (resolvedFullRebuildPaths.includes(file)) {

Review comment (suggestion):
```suggestion
      // where it is specified.
```

Code after:
      await outputFile(args['--output'], output)
    } else {
      println(output)
    }
  }

  let inputFile = args['--input'] && args['--input'] !== '-' ? args['--input'] : process.cwd()
  let inputBasePath = path.dirname(path.resolve(inputFile))
  let fullRebuildPaths: string[] = cssImportPaths.slice()

  function createCompiler(css: string) {
    return compile(css, {
      base: inputBasePath,
      onDependency(path) {
        fullRebuildPaths.push(path)
      },
    })
  }

  // Compile the input
  let compiler = await createCompiler(input)
  let scanner = new Scanner({
    detectSources: { base },
    sources: compiler.globs.map(({ origin, pattern }) => ({
      // Ensure the glob is relative to the input CSS file or the config file
      // where it is specified.
      base: origin ? path.dirname(path.resolve(inputBasePath, origin)) : inputBasePath,
      pattern,
    })),
  })

  // Watch for changes
  if (args['--watch']) {
    let cleanupWatchers = await createWatchers(
      watchDirectories(base, scanner),
      async function handle(files) {
        try {
          // If the only change happened to the output file, then we don't want to
          // trigger a rebuild because that will result in an infinite loop.
          if (files.length === 1 && files[0] === args['--output']) return

          let changedFiles: ChangedContent[] = []
          let rebuildStrategy: 'incremental' | 'full' = 'incremental'

          let resolvedFullRebuildPaths = fullRebuildPaths

          for (let file of files) {
            // If one of the changed files is related to the input CSS or JS
            // config/plugin files, then we need to do a full rebuild because
            // the theme might have changed.
            if (resolvedFullRebuildPaths.includes(file)) {