1

I created a multimedia component for css and js and attached these on page Template building block and when I browsed my publish page my css are not going to load how css and js are loaded on publish page.

give me solution?

  • please paste the piece of code from TBB where you are attaching CSS and JSS. – Saurabh Gangwar May 5 '14 at 6:04
2

Try to Use css and js like below in your TBB:

<link href="tcm:xx-xxxx" rel="stylesheet" type="text/css" />
<script src="tcm:yy-yyyy" type="text/javascript"></script>

Please refer to the answer by Nuno Linhares:

https://stackoverflow.com/questions/10555177/how-to-add-external-javascript-or-css-files-to-our-tridion-page

| improve this answer | |
1

Whilst you could (and probably should) argue that neither CSS and Javascript is content and therefore shouldn't be in the CMS, realistically many companies' front-end teams look after these files but are denied direct access to the servers in order to change them efficiently.

The solution we ended up using was "Publish Design Elements", which is part of Will Price's Generic TBBs. You can get it here:

https://sdltridionworld.com/community/2011_extensions/generic-2011-tbbs.aspx

If memory serves correctly, you create a folder structure in your design publication, say 020 Global Design > Design Elements > css > cssimages and store your CSS as a multimedia component.

Then, in your structure publication, you create structure groups to mirror that, e.g. 040 Global Web > css > cssimages (creating one structure group for each folder).

Create a single page in the css folder and pass a parameter to the TBB with the location of the design elements, and it'll take care of the rest.

There are probably more complete instructions in the TBBs, but the key point is that the structure group structure must mirror the folder structure including children.

It's a handy tool.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.