Skip to content

Instantly share code, notes, and snippets.

@ahmed-musallam
Created April 11, 2019 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmed-musallam/c4cbf8fed470a519af057a4982aeda93 to your computer and use it in GitHub Desktop.
Save ahmed-musallam/c4cbf8fed470a519af057a4982aeda93 to your computer and use it in GitHub Desktop.
The hackiest way to export/import namespaces between AEM instances without any external dependencies
/**
* EXPORT NAMESPACES
* 1. Open http://localhost:4502/crx/explorer/ui/namespace_editor.jsp
* 2. Open Chrome console, run script below
* 3. Copy result.
*/
/**
* IMPORT NAMESPACES
* 1. Open http://localhost:4502/crx/explorer/nodetypes/index.jsp
* 2. Click "Import Node Types"
* 3. Paste CND from above
* 4. Check the checkbox titled "Automatically register defined namespaces."
* 5. Submit
*/
(function(){
var namespacesCnd = "";
document.querySelectorAll("#mainTable > tbody table > tbody > tr")
.forEach(tr => {
var url = tr.children[0].innerHTML.replace(" ", "").trim();
var prefix = tr.children[1].innerHTML.replace(" ", "").trim();
namespacesCnd += "<'" + prefix +"'='" + url +"'>\n"
});
console.log(namespacesCnd)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment