Showing posts with label Publishing HTML. Show all posts
Showing posts with label Publishing HTML. Show all posts

Sunday 11 January 2015

Minification Tooling

Overview: Minification is the process of combining multiple css or js files, removing whitespaces and comments to improve web site performance.


Tools:
YUI Compressor(Yahoo)
Web Essentials(Microsoft)
Mavention(Microsoft)
Grunt
jscompress.com/
Google Code Compress (Google)


I'd always go for 1 of the Microsoft tools: Web Essentials or Mavention as the plug into Visual Studio, as a SharePoint guy this would be my preferred option.  Both the MS tools appear to use the same engine as the compression appears identical, work out to roughly 60% on both CSS and JS compression.

Wednesday 11 August 2010

Feature Receiver for dispaying Publishing Images as html in a document library

Problem: Publishing images can't be created on a document library however, using a site columns you can add Publishing Images & Publishing Html.  However the Fields don't display properly unless you create the content type from the site columns and lastly generate the document library from the content type.  I already have data so I need the existing columns to display as a custom list publishing image would work.

Resolution: Create a feature receiver to change the column properties pragmatically.  There is a catch in that this only applies if you haven't created the document library off the content type which in turn was created off the site columns.  Anyway, attached is a feature receiver scoped at web level look at the customised document library and make the publishing field rich text compliant.  

Thursday 5 August 2010

Retrieving Publishing Columns using a CAML Query

Overview: LINQ is easy and strongly type however, occasionally we need to get data in an optimised fashion or LINQ won't do the job i.e. inefficient queries, Publishing fields and we need to revert to a CAML query.

Code Example:

Explanation:
  1. Perform a CAML query, U2U still works on SP2010 and I use it to work out my CAML query.
  2. Add code that performs the query, optimise it (you don't need every field returned by CAML, you can look at the query results without the "ViewFieldOnly" & "IncludeMadatoryFields" setting and you will see how many fields are returned which for big queries isn't good).
  3. Using the SPListItem retrieve the field data from the publishing fields.
Andrew Connell explains how to extend SPMetal
Tobias Zimmergrin's blog has good Linq to SharePoint 2010 info, his blog on showing the CAML generated by LINQ to SharePoint queries is invaluable to work out what SPMetal is generating.
Update: 09/10/2010 Extend SPMetal to retrieve list attachments

Update 27/10/2010 - A re-hash of Tobias Zimmergrin's blog describing retrieving the CAML generated by a LINQ to sharePoint Query.