PHP Preprocessor script/library for Stylus?
I too was looking for a Stylus parser for PHP. After finding none, I created a basic one and put it up on GitHub for others to use / improve upon.
Current Features 3/20/2013:
- Omit braces
- Omit colons
- Omit semi-colons
- Custom functions
- Importing other files
- '&' parent reference
- Mixins
- Interpolation
- Variables
Bump. It seems that there still isn't an easy to use method of incorporating stylus into php. Here's my workaround (linux only, local development only). It is inspired by my other recent question about FAM.
install incron and stylus, under ubuntu this would be
sudo apt-get install incron
sudo npm install stylus -g
access incron watch table
incrontab -e
and add the following with suitable modifications:
/var/www/css/my.styl IN_MODIFY /usr/local/bin/stylus /var/www/css/my.styl
which basically means recompile my.styl into my.css on file change.
add resulting css to html header
<link href="path/tom/my.css" rel="stylesheet" type="text/css" />
Whenever you save the .styl
file, your .css
will be recompiled in the background. Skip the styus file in deployment, use the recompiled one.
No. But there are plenty alternatives that you could look in to, like LESS, Sass, HSS. Maybe there's a PHP parser for one of these.