I understood a simple proof of concept in https://github.com/edymtt/csscss-from-ironruby , which shows in a console application how to use IronRuby to run a source csscss code to parse CSS loaded from a file. To achieve this result, I started with this SO> question - you can find additional resources that I used in the comments to the program. I have not tried this code on ASP.net MVC - in any case, this sample should be a good starting point.
This solution is a bit cumbersome to maintain as you need to manually place sources for csscss and dependent libraries in the solution. An alternative solution is to install Ruby on the machine, install csscss using gem (so that it automatically downloads the dependencies), and call the program from .NET. I will also show this approach in an example. Please note that this solution requires that you can install Ruby on a web server.
UPDATE 2013-09-02 18:15 UTC Following Zach Moazeni's suggestion, I was able to come to terms with the approach IronRuby used to run csscss , and I updated the proof of concept accordingly. In a nutshell:
- outside of a .NET program. I used bundler to load
csscss and json (and dependent stones) into the local project folder; - in the .NET program, I wrote a function to detect all library paths in the gem folder created by
bundler (by searching for the gems folder and then for each subfolder for the lib folder, this algorithm was inspired by this SO thread ); - I passed this list of paths to the IronRuby interpreter before running
csscss .
This approach should combine the ability to use only .NET to run the program with the ease of updating given by gem and bundler .
source share