FrontEndManagementJS - TridionPractice/tridion-practice GitHub Wiki
This page outlines Tridion design approaches and trade-offs with two approaches to managing JavaScript.
JavaScript is code for which a Tridion developer is responsible for maintaining, and possibly writing. JavaScript is a dynamically typed programming language which is used predominantly for interactions in the web browser. Like any quality code, it should be well-architected so that it is flexible, maintainable, and sustainable. This will outline patterns for managing JavaScript.
There are two approaches for managing the JavaScript for a website in Tridion
- Multimedia Components
- JavaScript Schema
This approach is often used with a code repository.
- A developer uses WebDav to transfer JavaScript files from a code repo.
- JavaScript is put into Tridion using multimedia schema
- Default Multimedia Schema is used or a JavaScript multimedia schema is created
- The JavaScript binaries can be published to the web server
- JavaScript component template can be created, JavaScript components added to a page template for JavaScript, the JavaScript page is published
- Code Schemas
- Plain text Schemas
This approach is often used without a code repository.
- A developer copies and pastes JavaScript from a text editor into a code component.
- JavaScript is managed in Tridion as either a generic "code component" or a custom JavaScript component which contains a large plaintext field
- JavaScript components must be added to a JavaScript page template with a JavaScript component Template
- A JavaScript page is published
Pros | Cons | |
---|---|---|
Binary File | Easy to migrate from code repo, no risk of errors in migration | Cannot edit JavaScript in Tridion front-end debugging goes more slowly |
Code Component | Easy to migrate from code repo, no risk of errors in migration Can edit JavaScript in Tridion front-end debugging goes quickly Tridion can automatically publish the javascript in the correct encoding |
difficult to migrate from code repo risk of migration errors Difficult to write completely modular JavaScript for many front-end designers |