[web-devel] statically compiled css

Mark Bradley barkmadley at gmail.com
Thu Aug 5 07:33:58 EDT 2010


So I was thinking today about how far you can go with statically type
checked web programs.

Yesod uses Hamlet and web-routes, which allow you to statically type
check your internal urls and html.  What other parts of web
applications can you type check?

Well there are at least two other language domains that are commonly
used in web applications, CSS and javascript.  Javascript might be a
bit hard for now, but CSS type checking might be possible within
hamlet.

Has this ever happened to you?
you write an awesome css class that clears floats. called "AwesomeClearThing"

Now it is time to use it in hamlet
%p!class="AwesomClearThing"

Recompile + Reload later...nothing has changed...Fail!

what you need is:
%p!@class|AwesomClearThing@

and now since it is type checked, the compiler will tell you something is up.

This also has a prerequisite that yesod knows the css that is being
used.  Another interesting side note of this is that you could
potentially figure out which classes and rules are unused and not put
them in the compiled css file.  There are other things, but I think
type-checked class and id names would be a pretty awesome first step.

What do you guys think?


More information about the web-devel mailing list