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?

1
  • please paste the piece of code from TBB where you are attaching CSS and JSS. May 5, 2014 at 6:04

2 Answers 2

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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