PHP code example of nodejs-php-fallback / stylus
1. Go to this page and download the library: Download nodejs-php-fallback/stylus library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nodejs-php-fallback / stylus example snippets
use NodejsPhpFallback\Stylus;
// Require the composer autoload in your PHP file if it's not already.
// You do not need to if you use a framework with composer like Symfony, Laravel, etc.
owser:
header('Content-type: text/css');
echo $stylus->getCss();
// You can also get Stylus code from a string:
$stylus = new Stylus('
a
color blue
&:hover
color navy
');
// Then write CSS with:
$stylus->write('path/to/my-css-file.css');
// or get it with:
$cssContents = $stylus->getCss();
// Pass true to the Stylus constructor to minify the rendered CSS:
$stylus = new Stylus('path/to/my-stylus-file.styl', true);
composer