PHP preprocessor script / library for Stylus?

Is there a parser / library for "css stylus" for php?

If not, suggest something similar, if not better. Perhaps a small library that makes your css coding life easier in php.

The Stylus syntax removes all colons, semicolons, parentheses, and most parentheses from a regular CSS script. This simplicity and elegance reminds me of Lisp. What is even more surprising is that Stylus will also accept the usual CSS syntax in the same file, which will reduce possible friction between multiple contributors.

+6
source share
4 answers

Not. But there are many alternatives that you could pay attention to, for example LESS , Sass , HSS . Perhaps there is a PHP parser for one of them.

+2
source

I was also looking for a Stylus parser for PHP . Not finding any, I created a base one and put it on GitHub for others to use / improve.

Current Functions 3/20/2013:

  • Omit curly brackets
  • Omit colons
  • Lower half columns
  • Custom functions
  • Import other files
  • '&' parent link
  • Impurities
  • Interpolation
  • Variables
+8
source

Bump. It seems that there is still no simple method for including a stylus in php. Here is my workaround (linux only, local development only). This inspires my recent question about FAM .

install incron and stylus, under ubuntu it will be

sudo apt-get install incron sudo npm install stylus -g 

Table of access to windows with the inscription

 incrontab -e 

and add the following suitable modifications:

 /var/www/css/my.styl IN_MODIFY /usr/local/bin/stylus /var/www/css/my.styl 

which basically means recompiling my.styl to my.css when changing the file.

add the resulting css to the 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 style file in deployment, use recompiled.

+3
source

Why not just use the original implementation of Node.js?

exec will work fine, but you should only use it in a development environment.

 <?php exec('/path/to/stylus stylesheet.styl'); ?> 

In production, you must first build your stylus for both performance and safety.

+2
source

Source: https://habr.com/ru/post/914071/


All Articles