• Stars
    star
    2,210
  • Rank 20,877 (Top 0.5 %)
  • Language
    PHP
  • License
    Other
  • Created over 15 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

LESS compiler written in PHP

Build Status

lessphp v0.5.0

lessphp is a compiler for LESS written in PHP. The documentation is great, so check it out: http://leafo.net/lessphp/docs/.

Here's a quick tutorial:

How to use in your PHP project

The only file required is lessc.inc.php, so copy that to your include directory.

The typical flow of lessphp is to create a new instance of lessc, configure it how you like, then tell it to compile something using one built in compile methods.

The compile method compiles a string of LESS code to CSS.

<?php
require "lessc.inc.php";

$less = new lessc;
echo $less->compile(".block { padding: 3 + 4px }");

The compileFile method reads and compiles a file. It will either return the result or write it to the path specified by an optional second argument.

<?php
echo $less->compileFile("input.less");

The checkedCompile method is like compileFile, but it only compiles if the output file doesn't exist or it's older than the input file:

<?php
$less->checkedCompile("input.less", "output.css");

If there any problem compiling your code, an exception is thrown with a helpful message:

<?php
try {
  $less->compile("invalid LESS } {");
} catch (exception $e) {
  echo "fatal error: " . $e->getMessage();
}

The lessc object can be configured through an assortment of instance methods. Some possible configuration options include changing the output format, setting variables from PHP, and controlling the preservation of comments, writing custom functions and much more. It's all described in the documentation.

How to use from the command line

An additional script has been included to use the compiler from the command line. In the simplest invocation, you specify an input file and the compiled css is written to standard out:

$ plessc input.less > output.css

Using the -r flag, you can specify LESS code directly as an argument or, if the argument is left off, from standard in:

$ plessc -r "my less code here"

Finally, by using the -w flag you can watch a specified input file and have it compile as needed to the output file:

$ plessc -w input-file output-file

Errors from watch mode are written to standard out.

The -f flag sets the output formatter. For example, to compress the output run this:

$ plessc -f=compressed myfile.less

For more help, run plessc --help

More Repositories

1

moonscript

🌙 A language that compiles to Lua
Lua
3,026
star
2

lapis

A web framework for Lua and OpenResty written in MoonScript
MoonScript
2,923
star
3

sticky-kit

A jQuery plugin for creating smart sticky elements
CoffeeScript
2,908
star
4

scssphp

SCSS compiler written in PHP
PHP
1,351
star
5

sightreading.training

🎹 Sight reading training tool
JavaScript
443
star
6

magick

Lua bindings to ImageMagick for LuaJIT using FFI
Lua
404
star
7

pgmoon

A pure Lua Postgres driver for use in OpenResty & more
MoonScript
393
star
8

gifine

Quickly record and edit gifs and videos of your desktop
Lua
285
star
9

etlua

Embedded Lua templates
Lua
219
star
10

aroma

a game engine: lua, opengl es 2.0, native client
C
197
star
11

streak.club

a website for running creative streaks
MoonScript
142
star
12

tableshape

Test the shape or structure of a Lua table, inspired by React.PropTypes & LPeg
MoonScript
112
star
13

gifserver

A server for transcoding gif to video on the fly
Go
102
star
14

lovekit

Miscellaneous code for making games in LOVE with MoonScript
Lua
96
star
15

moonscript-vim

MoonScript support for vim
Vim Script
96
star
16

lua-enet

Bindings to ENet for Lua
C
85
star
17

gh-actions-lua

GitHub action for Lua/LuaJIT
JavaScript
83
star
18

heroku-openresty

Run OpenResty on Heroku with the Lua buildpack
Lua
78
star
19

sitegen

static site generator in MoonScript
Lua
76
star
20

lua-payments

Various payment provider APIs for Lua (and OpenResty): Stripe, PayPal
MoonScript
72
star
21

web_sanitize

Lua library for sanitizing, parsing, and editing untrusted HTML
MoonScript
70
star
22

moonlisp

a Lisp that compiles to Lua
C
67
star
23

scssphp-compass

Compass for scssphp
PHP
66
star
24

image-server-tutorial

An example of an image processing server in OpenResty and Lua
Lua
66
star
25

compohub

A website for listing game jams
CoffeeScript
62
star
26

lua-openai

OpenAI API bindings for Lua
MoonScript
52
star
27

lapis-community

Pluggable message board for Lapis powered websites
MoonScript
49
star
28

goattracker2

a fork of goattracker2
C
45
star
29

itchio-app-old

Desktop itch.io client
C++
45
star
30

gh-actions-luarocks

GitHub action for installing LuaRocks
JavaScript
43
star
31

loadkit

Loadkit allows you to load arbitrary files within the Lua package path
MoonScript
42
star
32

lapis-console

Interactive console for working with Lapis
Lua
42
star
33

cloud_storage

A Lua library for communicating with Google Cloud Storage
Lua
40
star
34

moonscript-javascript

MoonScript compiled to JavaScript with Emscripten
JavaScript
38
star
35

moonscript-tmbundle

textmate support for MoonScript
37
star
36

lapis-bayes

Naive Bayes classifier for use in Lua
MoonScript
30
star
37

moonrocks

command line tool for working with rocks.moonscript.org
Lua
29
star
38

lua-twitter

A Lua twitter library that works with OpenResty or LuaSocket
Lua
27
star
39

lua-mailgun

Lua bindings to Mailgun HTTP API
MoonScript
26
star
40

ludum-dare-browser

a website for browsing ludum dare games
HTML
25
star
41

lapis-redis

Redis integration for Lapis
Lua
23
star
42

lua-syntaxhighlight

A code syntax to HTML highlighter using lexers from Textadept
Lua
21
star
43

luajit-geoip

luajit bindings to maxmind geoip
MoonScript
21
star
44

lapis-systemd

systemd integration for lapis
Lua
18
star
45

lapis-exceptions

Exception tracking for Lapis
MoonScript
17
star
46

moonscript-javascript-compiler

compile moonscript to javascript
MoonScript
16
star
47

mursic

sight reading training tool
MoonScript
15
star
48

lapis-site

The homepage for Lapis
HTML
14
star
49

lua-date

LuaDate 2 modified to work with newer versions of lua/luajit
Lua
14
star
50

lua-base58

base58 decode and encode for strings in pure lua
MoonScript
13
star
51

moondoc

MoonScript library documentation generator
Lua
13
star
52

lapis-archlinux-docker

Dockerfile for running lapis in archlinux
Dockerfile
13
star
53

moonscript-love

LÖVE game engine with baked in moonscript support
C
13
star
54

lua-uinput

A Lua library for creating a virtual keyboard on Linux with uinput
MoonScript
13
star
55

ludum-dare-22

A game built in 48 hours for the Ludum Dare Competition
12
star
56

moonscript-site

CSS
11
star
57

heroku-lapis-example

An example of running Lapis on Heroku with heroku-openresty
Lua
11
star
58

imagesize

Detect size & format of image file
MoonScript
10
star
59

ludum-dare-27

theme: 10 seconds
MoonScript
9
star
60

ludum-dare-38

lets make a game "a small world"
MoonScript
9
star
61

ludum-dare-25

Make a game in 48 hours!
MoonScript
9
star
62

moonscript-textadept

Textadept support for MoonScript
MoonScript
9
star
63

saltw-bot

irc/twitch bot written in MoonScript
MoonScript
9
star
64

lapis-stats

Statsd and Influxdb support for Lua, OpenResty & Lapis
Lua
8
star
65

selfwatch

inspired by selfspy
Go
8
star
66

snes-renoise-instruments

Various snes samples ripped from spc -> xrni
8
star
67

lapis-spec-screenshot

A busted screenshot handler that takes images of your pages when testing
Lua
8
star
68

ludum-dare-24

Let's make a video game!
7
star
69

giflib

gif
MoonScript
7
star
70

garfield

garfield comic viewer 🐱
MoonScript
7
star
71

weeklyloops

loops for http://streak.club/s/134/weekly-loop
Go
7
star
72

lapis-annotate

Annotate lapis models with their schema from the database
Lua
7
star
73

moonscrape

web scraper
MoonScript
6
star
74

lessphp-site

the lessphp homepage
PHP
6
star
75

lapis-eswidget

A widget base class designed for generating ES modules for bundling JavaScript & more
MoonScript
5
star
76

wallrun-js

Trying to get love2d game working in browser using fengari
MoonScript
5
star
77

elng

an interpreted language running on erlang
Erlang
5
star
78

dullcache

A simple large file cache for sitting in front of storage provider to offload bandwidth
Go
5
star
79

ludum-dare-32

Something butt
MoonScript
4
star
80

uglyphp

a templating language for php with emphasis on macros
PHP
4
star
81

fireplace

GTK+ campfire client
Python
4
star
82

album-1

my first album, chiptune
4
star
83

net.leafo.MIDIThing

Control your MIDI modules from Renoise
TeX
4
star
84

gh-actions-openresty

Install OpenResty inside of your GitHub Actions runner
JavaScript
4
star
85

ludum-dare-23

make a game in 48 hours!
4
star
86

talkxtyper

Type with your voice
Go
4
star
87

workdad

a chorded keyboard layout and training program
MoonScript
3
star
88

lapis-http

HTTP library wrangler for OpenResty & Lua
MoonScript
3
star
89

somestory

lets make a game for real this time....
Lua
3
star
90

ludum-dare-30

Connected worlds
Lua
3
star
91

pixel-react

creating pixelated game interface with html in react
JavaScript
3
star
92

st

my terminal
Objective-C
3
star
93

awesome-config

My awesome configuration
Lua
2
star
94

godot-game-1

GDScript
2
star
95

ludum-dare-41

combine two genres
GDScript
2
star
96

noteshed

a personal wiki for notes
2
star
97

ludum-dare-31

Entire Game on One Screen
MoonScript
2
star
98

ludum-dare-40

Lets make another game
Lua
2
star
99

moonparse

MoonScript
2
star
100

gslog2pg

Copy Google Cloud storage logs into PostgreSQL
MoonScript
2
star