Code Monkey home page Code Monkey logo

hlx-test's Introduction

SAP Content Hub

Temporary location prior to enabling https://github.tools.sap/UDEx/dx-web

Environments

Documentation

All technical documentation of the project lives in /docs folder.

Installation

npm i

Linting

npm run lint

Local development

  1. Create a new repository based on the aem-boilerplate template and add a mountpoint in the fstab.yaml
  2. Add the AEM Code Sync GitHub App to the repository
  3. Install the AEM CLI: npm install -g @adobe/aem-cli
  4. Start AEM Proxy: aem up (opens your browser at http://localhost:3000)
  5. Open the {repo} directory in your favorite IDE and start coding :)

UDEX webcomponent integration

The plan is to use various webcomponents from the UDEX project to implement blocks where appropriate. The hero block currently already is using the HeroBanner component and can serve as an example of the approach.

In a nutshell, for each webcomponent, we need to create a proxy (called entry-point) in the entry-points directory. This file should just import the component from UDEX - e.g. in entry-points/entry-udex-hero-banner.js,

import '@udex/web-components/dist/HeroBanner.js';

we import the HeroBanner from UDEX. This new file, in turn, now needs to be added as an entry point in the vite.config.js:

...
      entry: [path.resolve(__dirname, 'entry-points/entry-udex-hero-banner.js')],
...

and into the import-map in head.html:

<script type="importmap">
  {
    "imports": {
      "@udex/web-components/dist/HeroBanner.js": "/dist/entry-udex-hero-banner.esm.js"
    }
  }
</script>

mapping the UDEX import to the output of the vite build (will be in the dist dir after the build - called the same as the entry point but with .esm.js as extension).

Next, we can already use that component in a block by importing it like normal and then starting to use the webcomponent e.g. for the Hero we do:

import '@udex/web-components/dist/HeroBanner.js';

export default async function decorate(block) {
...
  const hero = document.createElement('udex-hero-banner');
...

What is left is to run the build using npm run build (notice that the output in dist needs to be commited as well and that it is required to have run npm install to have all required dependencies installed). This is only necessary if a new entry-point has been added.

Finally, when a new update of the UDEX library is pushed to the CDN, it can be incorporated by updating the link in the package.json

  "dependencies": {
    "@udex/web-components": "https://cdn.udex.services.sap.com/dds/npm/web-components-0.25.0.tgz"
  }

pointing it to the new release and running npm run build. For now, the process of updates is manual - i.e., the UDEX team needs to make a new version available on the CDN and then, the url can be updated after this is communicated OOB. .

hlx-test's People

Contributors

pahupe avatar saurabh-khare avatar mhaack avatar mlangfordsap avatar benpeter avatar rjwtrmn avatar sanmishr avatar mng8fe avatar eduardseifert avatar carnix avatar karlpauls avatar sdmcraft avatar larsauffarth avatar rootpea avatar urfuwo avatar alexcarol avatar ok avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.