Git Product home page Git Product logo

less4laravel's Introduction

Less4Laravel

Allows you to use Less in Laravel 4 with no fuss, no muss.

Installation

Add jtgrimes\less4laravel as a requirement to composer.json:

{
    "require": {
        "jtgrimes/less4laravel": "0.1.*"
    }
}

Update your packages with composer update or install with composer install.

Once Composer has installed or updated your packages you need to register Less4Laravel with Laravel itself. Open up app/config/app.php and find the providers key towards the bottom and add:

'jtgrimes\Less4laravel\LessServiceProvider'

In the aliases section, add:

'Less'	=>	'jtgrimes\Less4laravel\LessFacade'

Configuration

In order to work with the configuration file, you're best off publishing a copy with Artisan:

$ php artisan config:publish jtgrimes/less4laravel

The defaults are:

  • Recompile whenever the .less file is updated. (Recompilation only happens when the named file is changed. If other files are imported, changing them will not trigger a recompile.)
  • Store .less files in app/less
  • Store generated .css files in public/css
  • Link to /css/filename.css

All of these defaults can be changed in /app/config/packages/jtgrimes/less4laravel.php.

Additionally you can (and probably should) have different configurations for development and production. Specifically, you probably don't want to be generating css files on your production server, since it will slow down your site.

Usage

In your view file, just call Less:to('file') to compile the .less file (if needed) and generate a link to the output css file.

Artisan Commands

They're not implemented yet, but compiling .less files from Artisan is on the to-do list.

Credits

Less4Laravel doesn't exist without Leaf Corcoran's lessphp. lessphp doesn't exist without LESS. Less4Laravel also requires Laravel. The readme is largely boosted from Rob Crowe's readme for (the very awesome) TwigBridge.

less4laravel's People

Contributors

jtboofle avatar jtgrimes avatar

Watchers

 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.