In my project we are accessing Tridion to publish the JS and CSS files, but in order to maintain consistency we need to publish all the required files every time. Is there any way to automate this, so that when run all related files in Tridion get published?

  • 2
    I would consider moving CSS and JS out of the CMS and making it part of web application deployment. On all projects I have worked on this has significantly reduced release management headaches
    – Will Price
    Commented Dec 3, 2013 at 14:33

7 Answers 7


If you're using SDL Tridion 2013, yes: you can add all items to a bundle, and publish the bundle.

If you're using any version prior to 2013, the only way I can think of is to have a template that publishes all those items as part of the same transaction.


In another project we created a schema called 'Site Assets' here all site assets like css icons, stylesheets, js, ico files etc we're embedded into this component.

The scheme was then linked to a dynamic component template that contained the logic to push the items to a specific location (Structure group).

This helped the technical users in the system keep track and published all items in a single go.

  • I'd agree with Nuno that the bundle is the best way to go, i'd propose the above solution pre 2013.
    – johnwinter
    Commented Dec 3, 2013 at 16:34

Pre 2011 you could use the event system to detect one of the items being published and publish the others that way.

2013 a bundle is the best way....


Depending on how your CSS and JavaScript publishing is currently implemented, it may be worth investigating using a Custom Resolver.

From the online documentation (login required):

Customizing the resolving process involves manipulating the list of items to publish that results from a publish action.

Using a Custom Resolver, you could ensure that if a CSS or JavaScript file is published (from a specified Folder or Structure Group), then all of the other CSS and JavaScript files are also published.

If you use a Bundle in Tridion 2013, then there is still a risk that you publish just one of the JavaScript or CSS files (rather than the whole Bundle) and that things get out of sync.


on Tridion 2011, another way is to automate publishing process by CoreService API, you can read a predefined list file, or a UI to input a list, a background process to publish them on a schedule. let me know if you have any question to build.

  • Whilst it's possible, it would be nice that this is automatically managed, rather than scheduled, for example if a user publishes content, then has to wait for a schedule to run
    – johnwinter
    Commented Dec 3, 2013 at 16:33
  • yes, this is another option for UI based application, click to run an batch process, publish anything direct or indirect, or upon some business logic or dependencies. this is very customized way to automate publishing process.
    – Lucas Liu
    Commented Dec 3, 2013 at 20:37

If you are managing the css and javascript as binaries, I would go with a TBB at the end of your Page Template or Component Template (depending on how you trigger the publishing) and let that TBB take care of adding the "required" binaries to the package and publish them along with the others.

I am suggesting the use of a Template Building Block because (in my opinion) is the easiest and least intrusive way of accomplishing it.

Then the challenge would be to identify/define which items should go together within the same publishing transaction, i.e. defining the publishing rule.

Once you figure that out it is a matter of organizing your binaries, for example, you could put them in a folder and publish any of the items in that folder will trigger the publishing of all the items in such folder; you could also have a page where you drop all the binaires as component presentations; you could use a bundle, you could use metadata to associate them, etc...

  • Maybe easiest and least intrusive, but the prospect of publishing JS/CSS as binaries is appalling. I would definitely stay away from it! Rather, implement Will's suggestion and move all JS/CSS outside of Tridion. Commented Dec 3, 2013 at 16:30
  • I think this would require quite some work to ensure publishing isn't automatically publishing binaries with each item. Imagine publishing 3 pages and with each page the binaries are deployed, that would be a lot of extra publishing for no reason
    – johnwinter
    Commented Dec 3, 2013 at 16:31
  • It is just an option. I don't think publishing css/js as binaries is appalling, it depends on the requirement and/or implementation, maybe as part of the continuous integration process the css/js are automatically uploaded to the CMS and then published. And remember that Tridion supports by default the references to js and css using tcm links. That said, I'd only publish css/js as pages or component presentations if I need to modify their contents at publish time, otherwise, the binary is the way to go, as long as you want tridion to take care of the css/js deployment. Commented Dec 3, 2013 at 16:41
  • @johnwinter, the whole css/js publishing needs to be analyzed and implemented properly, as you say, you don't want your package for each page to contain all the binaries over and over, that's why you use, experienced consultants for these things :) Commented Dec 3, 2013 at 16:43

There you go, Rupesh. You got 6 answers (7, if you include Will's suggestion) so far. Let me give you the 8th :) I hope you're not overwhelmed.

I would go for a combination of event system and structuring your website in Tridion Content Manager.

1) The structure would imply grouping together all your JS/CSS under a common Structure Group. For example, you could have the following:

    + Root
        + Assets
            | JS
            | CSS

2) The event system would intercept the publish of a JS or CSS Page or Component and it would resolve the Structure Group where it belongs to (e.g. JS). It would then take the parent SG (i.e. Assets) that is in fact the common SG for all JS and CSS Pages and it would publish that Structure Group.

This would ensure that all JS/CSS would be published together in one transaction. Optionally, you could fail the initial publish action on the JS/CSS individual Page/Component.

  • Why use an event system when I can use a TBB? :) Commented Dec 3, 2013 at 16:48
  • because you should not implement a bad approach, just for the sake of simplicity in coding :) Commented Dec 3, 2013 at 16:50
  • For me, both, Event System and Templating are equally simple (or complex). I disagree Mihai. Commented Dec 3, 2013 at 16:59

Your Answer

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

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