written by Miss Integration, 14. November 2011
Thanks to Graeme Heath, the Web Designer/Info Architect with 5+ years experience working with the content structure in CMS, here is the summary of our “best practice approach” in delivering site structure which we think is the best for now.
Over the last 2 years a lot of talk has focused on getting CSS and JS files out of a Management Server project and putting them into a separate publication target or website. The two main approaches were either linking the CSS and JS resources into to hard linked locations created by clever project variants/publication packages. The other method was to keep all the CSS/JS files in an external site and just link to them. (The first method was demonstrated in the Best Practice project that came with MS v10).
Both of these approaches did not suit us – the Best Practice approach was cumbersome for designers wanting to create or update CSS and JS – see above. (Pretty well every project we’ve done has required the designers to update and expand the CSS and JS files frequently). The external site approach loses the benefits of working with assets in Management Server – that of being able to selectively publish to different targets and move between environments.
For the last 6 months we’ve been using a compromise solution that has given us more flexibility but still kept all the assets under management, and allowed us to publish to the publication server/s via publication packages.
Here’s the approach in a nutshell:
Note that we have not implemented this for a multilingual site. If CSS or background images are language dependent then a dedicated CSS folder may be required for each language variant, and hence multiply the effort.
The designer can build and test the CSS in a Dreamweaver project (yeah, designers still love DW) and can set up remote server connections and push new files and versions to the virtual directory location. If you _have_ to use Managment Server for versioning then use check-in/out from the DW project location. We find that using file versioning on DW projects is easier to manage (using SSafe or SubVersion).
<link rel="Stylesheet" type="text/css" href='<reddot:cms>
<if>
<query valuea="Context:CurrentRenderMode" operator="!=" valueb="Int:2">
<htmltext><%stf_LocalServerAssetLocation%>/css/css-main.css</htmltext>
</query>
<query type="else">
<htmltext><%med_CSSMain%></htmltext>
</query>
</if></reddot:cms>' />
<p>CSS Files</p> <p><a href=”[ioID]14E5A5B22D6B430184095DA564B641CC/css-data.css”>css-data.css</a></p> <p><a href=”[ioID]14E5A5B22D6B430184095DA564B641CC/css-location.css”>css-location.css</a></p> …
Using Excel to generate the list of links will speed up the time taken to create them. If you’ve added new sub-folders then run Update Asset Manager from SmartTree before yiu try to connect to the new items.
(* Confession – I’m a designer too. On _very_ rare occasions I’m highly strung)
Graeme Heath
Source: Best Approach for Managing CSS and JS
© copyright 2011 by Shelly Mao / Miss Integration