Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better CSS in .NET? [closed]

Tags:

.net

css

sass

less

I'm getting slightly jealous of the innovation I'm seeing from the Python and Ruby community around CSS. For example, see:

  1. http://sandbox.pocoo.org/clevercss/
  2. http://lesscss.org/
  3. http://sass-lang.com/

That said, my question is two fold. Could these library's be easily "ported" to .NET via IronRuby and IronPython so I could then write MSBUILD tasks or HTTP Handlers in C#?

Also, should I bother with this, or is someone else in the .NET community already working on this?

UPDATE: Since I wrote this original question, there has been a lot of work in the .NET community in this space. Check out the following tools that provide assistance for LESS, SASS and even CoffeeScript:

  • Chirpy
  • Web Workbench
like image 543
nikmd23 Avatar asked Jun 26 '09 14:06

nikmd23


4 Answers

http://www.dotlesscss.org/ - My attempt at playing around with Less for .NET.

like image 53
Owen Avatar answered Nov 14 '22 00:11

Owen


It would be nice to port SASS to .NET, because it's such a nice tool and .NET is such a nice platform. But there's not really much need, because we can continue to use the Ruby tool as-is. You can very easily add a step to your build process which compiles SASS files into CSS files using the Ruby tool.

Here's mine.

#PostBuild.rb
#from http://sentia.com.au/2008/08/sassing-a-net-application.html
#Post-build event command line: rake -f "$(ProjectDir)PostBuild.rb"

require 'haml'
require 'sass'

task :default => [ :stylesheets ]

desc 'Regenerates all sass templates.'
task :stylesheets do
    wd = File.dirname(__FILE__)
    sass_root = File.join(wd, 'Stylesheets')
    css_root = File.join(wd, 'Content')
    Dir[sass_root + '/*.sass'].each do |sass|
        css = File.join(css_root, File.basename(sass, '.sass') + '.css')
        puts "Sassing #{sass} to #{css}."
        File.open(css, 'w') do |f|
            f.write(Sass::Engine.new(IO.read(sass)).render)
        end
    end
end
like image 32
yfeldblum Avatar answered Nov 14 '22 02:11

yfeldblum


I use this, it rocks!

got to read these links: http://www.hanselman.com/blog/CoffeeScriptSassAndLESSSupportForVisualStudioAndASPNETWithTheMindscapeWebWorkbench.aspx

http://www.mindscapehq.com/products/web-workbench/getting-started

like image 3
PDA Avatar answered Nov 14 '22 00:11

PDA


CSS Variables can be accomplished with HTTP Handlers.

http://www.webpronews.com/blogtalk/2006/10/16/add-variables-to-standard-css-stylesheets-in-aspnet

I imagine a lot of the other useful features exist in some form, which are you interested in specifically?

like image 2
Bob Avatar answered Nov 14 '22 00:11

Bob