One of the most in-efficiencies that exist in AEM Developer’s workflow is having to do full builds when making minor changes or when content needs to be downloaded from AEM instances (local or other environments). Due to these in-efficiencies developers often resort to using tools like CRXDE Lite to manipulate files or node properties directly in AEM which has several drawbacks. CRXDE doesn’t provide any syntax checking and often changes across multiple files get forgotten and left there – it’s hard to keep track of what you changed when touching multiple files.
In this article, we will look at some modern solutions to quickly get files in and out of your AEM to speed up your local development workflow.
#1: WATCH & SYNC
Following are some tools that you can use which are great for achieving this hot reload
#1.1: NPM (AEM Sync)
One of the popular ways to push your code to the CRX repository is using an NPM plugin created for the same.
It’s a Node package that you can use to listen to file changes. Have it running in the background, and changes you make in your IDE will be reflected automatically in AEM.
The only disadvantage of this is you can only push it. There is no option to import files from the CRX repository.
Steps to configure:
Open terminal and install NPM if you do not have it already. (https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
Once NPM is installed, run this command to install AEM Sync Plugin
Npm i aemsync -g
Once aemsync is installed, run this command in the terminal.
Aemsync -t http://admin:admin@localhost:6502 -w \path\to\workspace
This can also be run with only the command aemsync from the desired workspace, and it will take the default parameters. You can also use it with the publisher instance by mentioning the respective URL and Port.
Now, every file and folder under the mentioned path will be automatically synced with the CRX repository when there is a change in the file/folder.