0

Is there any CSS frameworks like Sass and Compass for developing in PHP that use similar methods of CSS abstraction.

6 Answers 6

6

Yeah - how about Sass and Compass? I'm using these with PHP right now. Although they rely on Ruby for compiling this doesn't mean that you can't use these solution to deploy css on your PHP sites.

The framework Symfony has an asset manager called Assetic that includes a Compass filter allowing direct compilation of Sass into CSS as part of your development process (in PHP).

https://github.com/kriswallsmith/assetic

12
  • Okay I didn't know that. My Ruby skills aren't so proficient so I'm going to see if there are any others perhaps specifically made for PHP.
    – Chaim
    Jul 13, 2011 at 17:17
  • What I'm trying to say is you don't have to know ruby AT ALL. As long as you can install packages in linux then you're all set. Example 'sudo apt-get install ruby rubygems' then 'sudo gem install compass'. Bang - you're done. Jul 13, 2011 at 17:22
  • 1
    Let me put it another way. How much do I know about cars? Not a whole lot - but I drive one every day. Jul 13, 2011 at 17:22
  • Okay, I get what you saying. Can you do this in Windows? Also if I'm going to be using shared hosting how would I install it?
    – Chaim
    Jul 13, 2011 at 17:28
  • 1
    Well most hosts these days have ruby installed but that isn't a big deal because you can compile your sass locally and then only deploy the CSS (which would be the sensible thing to do anyway - you want to pre compile your assets). I use windows too but I run Linux in a VM - this is a really good solution for development (and it's free). You can also install ruby for Windows natively but I would highly reccommend Linux in a VM (Ubuntu in Virtualbox). Jul 13, 2011 at 17:35
2

You can use less (http://lesscss.org/). The main difference between sass and less, is that less can run on the client side.

1
  • 2
    run == compile at runtime (everytime) == much slower. Although I can see why it would be an advantage during development (though there are sass workflows that auto complile when changes are made). Aug 26, 2011 at 12:23
2

I just found LESSPHP that does what is says: gives you LESS for PHP.
http://leafo.net/lessphp/

1
  • yeah but LESS is a poor man's SCSS and isn't compatible with compass
    – Alex
    Aug 11, 2013 at 11:09
1

I just got SASS to work on my Ubuntu dev machine thanks to kissmyface. I started with ZERO understanding of how SASS works and ABSOLUTELY no Ruby experience. Here's the step by step:

Install ruby and SASS (assumes you're root):

> apt-get install ruby
> apt-get install rubygems
> gem install sass
> gem install listen

I had to install the listen gem to fix a bug where listening was broken. Gems are like teh Ruby equivalent of apt packages, or Apache modules, or whatever.

SASS runs as a service and compiles .sass and .scss files into .css files. Here is how to start the sass service, tell it to watch input.scss, and compile it to output.css when a change is detected:

> sass --watch input.scss:output.css

You can also have SASS watch a directory and probably do other fun stuff, docs are here: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html

Much gratitude to kissmyface :) Also, kissmyface is right on about running an Linux VM on Windows - I use VmWare to run an Ubuntu VM to get the awesome benefit of NetBeans IDE with PHP debugging :)

Regarding deploying it on shared hosting, good luck with that :/ I will probably just use SASS during development - when the site is done, I'll simply deploy the compiled CSS file(s).

1
0

Here are two PHP based CSS proccesors that I found:

0

The best parser I've seen for PHP so far is this one.

http://code.google.com/p/phamlp/

It look slike it hasn't been touched in nearly 2 years, but it's still the best one I've seed so far.

Not the answer you're looking for? Browse other questions tagged or ask your own question.