Code Monkey home page Code Monkey logo

less's Introduction

less

Latest Stable Version Build Status StyleCI Test Coverage Code Climate

PHP wrapper to execute less node package or fallback to a PHP alternative.

Usage

First you need composer if you have not already. Then get the package with composer require nodejs-php-fallback/less then require the composer autload in your PHP file if it's not already:

<?php

use NodejsPhpFallback\Less;

// 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.
require 'vendor/autoload.php';

$less = new Less('path/to/my-less-file.less');

// Output to a file:
$less->write('path/to/my-css-file.css');

// Get CSS contents:
$cssContents = $less->getResult();

// Output to the browser:
header('Content-type: text/css');
echo $less;

// You can also get less code from a string:
$less = new Less('
a {
  color: blue;
  &:hover {
    color: navy;
  }
}
');
// Then write CSS with:
$less->write('path/to/my-css-file.css');
// or get it with:
$cssContents = $less->getResult();

// Pass true to the less constructor to minify the rendered CSS:
$less = new Less('path/to/my-less-file.styl', true);

less's People

Contributors

kylekatarnls avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.