h-rafiee / Laravel-lessphp-leafo by h-rafiee

Lessphp leafo for Laravel 5
86
3
1
Package Data
Maintainer Username: h-rafiee
Maintainer Contact: h.rafiee91@gmail.com (Hossein Rafiee)
Package Create Date: 2016-05-19
Package Last Update: 2018-06-16
Language: PHP
License: MIT
Last Refreshed: 2024-05-04 15:09:32
Package Statistics
Total Downloads: 86
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 3
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

LESS For Laravel 5.x Without Node.js

LESS with your Laravel. Using Leafo.php

Features

  • Can modify LESS variables on-the-fly
  • Can parse custom CSS/LESS and append it to the resulting file
  • Caching support

Installation

You need composer to install.

$ composer require laravelless/lessphp

Add Provider,Facade to config/app.php

    'providers' => [
        ...,
        Laravelless\Lessphp\LessphpServiceProvider::class,
    ];
    /**********/
    'aliases' => [
        ...,
        'Lessphp'   => Laravelless\Lessphp\LessphpFacade::class,
    ];

After that you need publish vendor.

$ php artisan vendor:publish

Now you must have config/Lessphp.php so you can edit that where is your LESS path and your file must be excute to CSS

    return array(
        'css_path'          => base_path('css'),
        'less_path'         => base_path('less'),
        'cache_extension'   => '.cache',
        'formatter'         => "compressed",
    );

Functions

For execute to css is simple :

    $filename = 'style.less';
    $less = \Lessphp::compile($filename);

NOTE : Lessphp return url("css/$filename.css") Will be fixed soon to dynamical path.


For execute cached less => css

    $filename = 'style.less';
    $less = \Lessphp::cacheCompile($filename);

NOTE : You can set output filename for cacheCompile as second parameter.

    $less = \Lessphp::cacheCompile($filename,'style-min');

You can set variables before compile like this :

    $data = [
                'myBorderRadius'=>'5px',
            ];
    $less = \Lessphp::setVariables($data)->compile($filename);

License

HRAFIEE

IT's Free , SO Enjoy your free World