Minify your CSS through Regex (weblogs.asp.net)

published 1 year, 11 months ago, submitted by zowenszowens(905) 1 year, 11 months ago

Decreace the size of your CSS stylesheet through a few simple and easy Regex replacements.

1 comment | category: | Views: 55

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:

Comments:

posted by yesthatmcgurkyesthatmcgurk(3805) 1 year, 11 months ago

I have a website that interfaces with a legacy system database where I do something very similar.

I don't control the database, so all my queries are ad hoc. I have a class that takes different query parts (security, formatting, etc) and combines them into a single query string returning multiple datasets. But the queries are so complex and large (my max is 11 pages) that I need to have them well formatted for debugging. There's nothing like taking a 11 page query that's been optimized for space and trying to format it by hand in Query Analyzer.

So I format the query parts within my query generator class as multiline const string literals (@), and when the class is instantiated it combines all the query parts into readonly static queries. A compiler directive is used to run a regex minifier over the query strings if the application isn't in debug mode. So, for debugging, I can capture queries as they're run and paste them from Profiler into QA and have a nicely formatted, humongous query to debug whereas when in release mode the query is squeezed down as much as possible.

Whew. That was long winded.

information Login or create an account to comment on this story