The File Trigger keeps track of specific files and instructs Airdrop to rebuild assets when any of them change.
1/*2 * Trigger a rebuild when files change.3 */4FileTrigger::class => [5 /*6 * Files or folders that should be included.7 */8 'include' => [9 // By default we include every file in your resource path. Usually10 // this makes the most sense and doesn't need to be changed.11 resource_path(),1213 // Any time the webpack.mix.js file is changed, it could affect the14 // the build steps, and therefore the built files.15 base_path('webpack.mix.js'),1617 // Depending on your package manager, you'll want to uncomment one18 // of the following lines. Whenever JS packages are updated or19 // removed, the assets will need to be rebuilt.20 // base_path('yarn.lock'),21 // base_path('package-lock.json'),2223 // If you use NVM to manage your node versions, you'll want to24 // rebuild your assets anytime the node version changes.25 // base_path('.nvmrc'),2627 // If you use Tailwind, uncomment the following line. Changing your28 // Tailwind config will change the CSS files that are generated.29 // base_path('tailwind.config.js'),30 ],3132 /*33 * Files or folders that should be excluded or ignored.34 */35 'exclude' => [36 //37 ],38]
Including & Excluding
The File Trigger allows both an
exclude key, so if you want to include a whole directory and exclude a particular file, you can do that:
1FileTrigger::class => [2 'include' => [3 resource_path(),4 ],56 'exclude' => [7 resource_path('file-to-be-ignored.blade.php'),8 ],9]
Asset Package Managers
If you're using NPM to manage your frontend packages, you'll want to include
package-lock.json so that whenever you add, remove, or upgrade packages then Airdrop will rebuild your assets.
1FileTrigger::class => [2 'include' => [3 resource_path(),4 'package-lock.json'5 ],6]
In the same way, if you're using Yarn, add
1FileTrigger::class => [2 'include' => [3 resource_path(),4 'yarn.lock'5 ],6]
If you're using Tailwind CSS, make sure you include that as well, as any changes to the Tailwind config will affect the resulting assets.
1FileTrigger::class => [2 'include' => [3 resource_path(),4 'tailwind.config.js'5 ],6]