Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
aem-htl-builder
Advanced tools
Module for Adobe Experience Manager (AEM) to automate the conversion of HTML code into Sightly, as well as generate the associated Java Sling Models and XML dialogs, aiming to streamline the development process of AEM components.
The goal of this project is to automize the process of translating the html file into sightly and generating AEM components. This project is being developed as a part of the IT Graduation project.
Please feel free to leave any feedback or remarks about the project on the github discussion page.
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Make sure to install as well node.js and npm
Node.js :
Npm:
Install aem-htl-builder with npm
npm i aem-htl-builder
If you cloned this repository instead of installing it via npm, to run the scripts go to package.json file and run the scripts from there.
After installing the module, you need to set up a configuration file. Run the following command to create an empty configuration file.
npx aem-htl-builder configure
Now that the file has been created you need to configure it. Here is an example of valid configuration file:
{
"project": {
"aemProjectPath": "/Users/username/projects/mysite",
"rootPackage": "com.mysite.core",
"componentGroup": "MySite - Content",
"appName" : "mysite"
},
"html": {
"useSingleFile": true,
"singleFilePath": "/Users/username/html-files/test.html",
"directoryPath": "/Users/username/html-files"
}
}
And below is the detailed description of what each field does:
aemProjectName/core/src/main/java/
aemProjectName/ui.apps/src/main/content/jcr_root/apps/
directory in your AEM project. This folder contains your project-specific components, templates, and other resources.singleFilePath
field. If set to false, the module will prompt the user to select an HTML file via the terminal from directoryPath
.You can also set-up configuration by simply running the script with already specified parameters (example below):
aem-htl-builder configure \
--aemProjectPath="/Users/username/projects/mysite" \
--rootPackage="com.mysite.core" \
--componentGroup="MySite - Content" \
--appName="mysite" \
--useSingleFile=true \
--singleFilePath="/Users/username/html-files/test.html" \
--directoryPath="/Users/username/html-files"
This section provides a detailed guide on how to prepare your HTML for processing by this module. It covers the necessary attribute HTML syntax for each AEM component field type.
Here is a list of all the attributes that are currently supported by the module:
The [VarName] placeholder represents the variable name you choose for the field and should be replaced by the actual name in your HTML.
To add a textfield to your component, you need to follow these steps:
Add the textfield-[VarName] attribute to your paragraph tag, replacing [VarName] with your chosen field name.
<p> Component Title </p>
<p textfield-title> Component Title </p>
To add a textarea to your component, you need to follow these steps:
Add the textarea-[VarName] attribute to your paragraph tag, replacing [VarName] with your chosen field name.
<p> Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p textarea-message> Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<div>
<p>Species: Human</p>
</div>
<div checkbox-check>
<p>Species: Human</p>
</div>
To add a link to your component, you need to follow these steps:
Add the link-[VarName] attribute to your paragraph tag, replacing [VarName] with your chosen field name.
<a href="#">
Click Here
</a>
<a link-linkToWebsite href="#">
Click Here
</a>
To add an image to your component, you need to follow these steps:
Add the img-[VarName] attribute to your html tag, replacing [VarName] with your chosen field name.
<img src="/banners/img1.png" alt="Img Description"/>
<img img-bannerImg src="/banners/img1.png" alt="Img Description"/>
<select data-select-cars name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
If you have an element in your html which will be used for i18n you will need to:
Add the i18n-[VarName] attribute to your html tag, replacing [VarName] with your chosen field name.
<div>
<span>Location</span>
<span>Contact</span>
</div>
<div>
<span i18n-location>Location</span>
<span i18n-contact>Contact</span>
</div>
After running aem-htl-builder convert
command following will be added to:
{
"Location": "Location",
"Contact": "Contact"
}
If there is already in en.json file the key with the same name e.g. 'Location' this example would override its value with new one.
The description
requires the presence of another attribute from the list.
<p> Component Title </p>
<p textfield-title description="This field defines the component title"> Component Title </p>
textfield-title
serves as an example and it can be as well e.g. img-varName
, link-varName
etc.
If you want to add a list to your component, you need to follow these steps:
Add the list-[VarName] attribute to <ul>
tag, replacing [VarName] with your chosen list name.
<ul>
<li>
<div>
<h3>Margherita</h3>
</div>
<p>10.99 €</p>
</li>
<li>
<div>
<h3>Pepperoni</h3>
</div>
<a href="#">Click the link here!</a>
<p>13.99 €</p>
</li>
</ul>
<ul list-pizzas>
<li>
<div>
<h3 textfield-title>Margherita</h3>
</div>
<p textfield-price>10.99 €</p>
</li>
<li>
<div>
<h3>Pepperoni</h3>
</div>
<a link-pizzaLink href="#">Click the link here!</a>
<p>13.99 €</p>
</li>
</ul>
Notice that since this is a list you need to add attributes only to elements which you want to include in the list (multifield) only once.
After running aem-htl-builder convert
command following code will be added to component dialog:
<pizzasModelList
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
fieldLabel="pizzasModel"
composite="{Boolean}true">
<field jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./pizzasModel">
<items jcr:primaryType="nt:unstructured">
<title
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="title"
name="./title"/>
<price
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="price"
name="./price"/>
<pizzaLinkContainer
jcr:primaryType="nt:unstructured"
jcr:title="pizzaLink Container"
sling:resourceType="granite/ui/components/coral/foundation/form/fieldset">
<items jcr:primaryType="nt:unstructured">
<pizzaLinkCheckbox
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/checkbox"
text="Open link in another tab."
name="./pizzaLinkCheckbox"
value="true"/>
<pizzaLink
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldLabel="pizzaLink"
name="./pizzaLink"
required="{Boolean}false"
rootPath="/content"/>
</items>
</pizzaLinkContainer>
</items>
</field>
</pizzasModelList>
The module will as well add the original HTML list as a comment under the newly converted list.
After successfully setting up configuration, and adding custom attributes to original HTML file run the following command to create AEM component
npx aem-htl-builder convert
FAQs
Module for Adobe Experience Manager (AEM) to automate the conversion of HTML code into Sightly, as well as generate the associated Java Sling Models and XML dialogs, aiming to streamline the development process of AEM components.
The npm package aem-htl-builder receives a total of 4 weekly downloads. As such, aem-htl-builder popularity was classified as not popular.
We found that aem-htl-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.