Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Minify your CSS
06-11-2013, 10:43 AM
Post: #1
Minify your CSS
As of clearFusionCMS 1.2.0 you can now minify your CSS when serving it out of a document.

Getting your CSS into a Document
If you don't already have your CSS within clearFusionCMS then first:
  • Create a new template, we'll named it blank and just place the [[+content]] snippet in it
  • Next create a new Document to hold the CSS
  • Set the Content Type to CSS
  • Set the template to blank
  • Disable the WYSIWYG Editor for the document
  • Paste your CSS into the document and save it
  • Update your existing style sheet links to put to the new document
Everything should be working as before except that the CSS is now being served out of the CMS and being gzip compressed.

Minifying the CSS
Now we just need to minify the CSS, so edit the Document holding your CSS:
  • As the first line in the document add [[minifyCSS &css=`
  • As the last line in the document add `]]
  • Save the document
That's all there is to it, you're site is now serving CSS minified, compressed and cached.

At this time minification removes whitespace and comments.

clearFusionCMS Lead Developer
Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump:

User(s) browsing this thread: 1 Guest(s)