in

 

The Product Blog

The Product Blog is where you can learn about product releases, features, what's new, and what's next. Bloggers include Product Managers, User Experience folks, and our User Education team.

Increasing Performance, via smaller downloads

As a company that competes against windows based applications, and the flashy AJAX products, performance is something that is become more and more of a big deal. As our customers are dealing with larger sets of data, and utilizing our system more and more, we realize that the pauses between pages, and extra clicks are becoming an issue.

Any easy way to make load times quicker is to compress our static files, which is what I spent today doing. After our build process, we run JSCompress and CssTidy which removes redundancy and unnecessary content from the files then re-packages them.

To run CssTidy, you'll need to download the package from thier website and put the exe somewhere accessable. Then you need to add the following lines to your msbuild file.


<ItemGroup>

    <CssFiles Include="C:\dev\Website\**\*.css"/>

</ItemGroup>

 

<Target Name="CompressCss">

    <Exec Command="C:\CssTidy\csstidy.exe %(CssFiles.FullPath) %(CssFiles.FullPath) --template=highest" />

</Target>



One of the important things to note here is the % sign, this tells MSBuild to do this task once for each item in CssFiles, which since you recusively included all the css files in the website dir (**\*.css) should be all the css files for your project.

At this point, just do a <CallTarget Targets="CompressCss"/> when you want it to fire off, and your good.

The same is true for JSCompress, only its available as a MSBuild task, so we don't have to do this Exec stuff.

Include the task, a member of the MSBuild Community tasks

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>

Then, do as before, build a list of JS Files, and pass them to the JSCompress Task. (Documentation for this is only available offline as part of the MSBuild Community Tasks install.)

<ItemGroup>

    <ScriptFiles Include="C:\dev\Website\**\*.js"/>

</ItemGroup>

 

<Target Name="CompressJS">

    <JSCompress Files="%(ScriptFiles.FullPath)"></JSCompress>

</Target>


Hopefully you should see the gains of this in our next release of eProject!


Comments

No Comments

Navigate: Home | Blogs | Forums | Solution Library  Get Help:  Contact | Feedback | FAQ   Terms of Use:  Terms & Conditions | Privacy Policy