`The Dreamweaver integration for Modular Templating enables you to rapidly upload HTML designs into SDL Tridion and publish them onto your website. However there are some common stumbling blocks related to how 2nd level dependencies are managed (for example the relationship between CSS and images), and the structure of the published files on your website. This article outlines these issues and illustrates a simple approach to overcome them.
Easily Publish Website Design
Article Sections
The Get Design Elements Template Building Block described in this article can be downloaded here .
- Easily Publish Website Design (1) - The basics
- Easily Publish Website Design (2) - An example
- Easily Publish Website Design (3) - How to publish the whole design
- Easily Publish Website Design (4) - Limitations and Further Ideas
Limitations and Further Ideas
There are a couple of limitation of the approach:
Firstly is that the relationship between 2nd level dependent items is not managed in the CMS, so I can, for example delete the fancy-bullets.gif image from the CMS, although it is still published on the site. This is not a new thing (you can, for instance unlink an image from a published component, and delete the image). You should be sure that if you delete images, that you republish the page which does this binary publishing (in which case the image will be removed).
Secondly there can be clashes if I do delete a file without un-publishing and then add a new file with the same name. Tridion will cause the publish transaction to fail, as it will not allow images with the same filename, but different uris to be published to the same location. You may want to extend your solution to make it hard for designers to make mistakes like these.
Obviously this is a quite simple first step to get you started, there are lots of other things that you may want to do with your design files like:
- Minifying the files on publishing. You could take the binary content of the CSS and JS and minify it on publishing. There are 3rd party libraries out there which can be integrated into your TBB.
- Combining all CSS into a single file. To decrease the number of requests to your webserver and improve performance you might want to combine all CSS into a single CSS file. This would require your TBB to do some processing of the DWT output to remove existing CSS links and put in a new consolidated link.
- Creating a unique filename every time a file is updated, to avoid problems with browser caching (for example I might append the component version number to the file name so every time styles.css was published it got a new name (and thus was not read from a browser cache) - styles-v1.css, styles-v2.css etc.
- Have your design files published to a different location or even webserver. In SDL Tridion 2011 you can configure the storage layer to put files in different locations based on file extension - this can be used to serve such files in a more efficient manner.