Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Commit

Permalink
actualize readme
Browse files Browse the repository at this point in the history
  • Loading branch information
velosipedist committed Apr 30, 2014
1 parent 926df26 commit 70e3a07
Showing 1 changed file with 26 additions and 45 deletions.
71 changes: 26 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,62 @@

Can include .less stylesheets into HTML template instead of common css manager's output (even if has printed).

For now supports only plain php templates. Twig, Yii, Laravel, etc will be supported in nearest future using additional bridges.
For now supports only plain php templates (works in Bitrix, Wordpress etc).
Twig, Yii, Laravel, etc will be supported in nearest future using additional bridges.

## Workflow

Draft for now:

* Requesting `www.yourdomain.com/{lessnichy-dir}` from browser for log in to Lessnichy site-wide session.
* After session opened, small helper toolbar will be sticked at browser window in any site page.
* Edit & upload your LESS files, they will be compiled & saved automatically

### Browser toolbar features

Planned the following:

* notify about changed LESS files
* re-compile page stylesheets by demand
* turn less.watchMode on & off
* log you out from session

### Draft code plan
### Where to put it and how to use

```yaml
# app directories structure
/webroot
/app-can-have-any-files
...
template-somewhere.php # use LESS::connect() in <head>, calls server
/any-folder
/lessnichy
/js
lessnichy.js # client-side LESS compilation listener
index.php # lessnichy sources entry point
slim.phar # distribute router in compact way
Lessnichy.php # service facade

/lessnichy-custom-dir # must be web accessible
index.php # lessnichy sources entry point, use LESS::listen()
lessnichy.phar # include this in index.php before listen
.htaccess # copy from /example dir, to catch browser yoddles, will be auto-bundled in future

```

```yaml
# config
# config.yaml or json, for future versions
minify: true
gzip: false
enable_less: true # for LESS developing sessions
#etc
```

```php
// index.php
## Requirements

$app->get('/', function(){
// session login functionality
// + give hints doc about usage & workflow
});
- php 5.3+
- jquery on client side
- no node.js, additional libs, even composer!

$app->get('/:sourcename.css', function(){
// gzip css output
});
## Building phar

$app->put('/:sourcename.less', function(){
// update CSS file content with internal minifier
// using for example https://packagist.org/packages/matthiasmullie/minify
});
```

```php
// workflow

// 1. Print trackable .less sources somewhere on php template
Lessnichy::register([
'/css/main.less', // webroot will be guessed if path starts from /
'@webroot/css/add-lib.less', // maybe paths will be just webroot-related or @tokenized
]);

/*
under the hood:
- bootstrap Lessnichy on first register() call
- detect absolute url for ajax calls
- register_shutdown_function() for post-printing LESS.compiled hook with DOM Mutation Observer
- queue LESS scripts setup:
- var less = {watch: true, interval: 3000} from add options, must be printed before less.js script
- queue registered files
- <link ... rel="stylesheet/less" href="{path-to.less}"/> print task
- capture mapped <link ... href="{path-to.css}" /> and replace with .less on shutdown if possible
*/
Clone repo on your dev machine with git & phing installed run

```
phing build
```

Wait about 10 seconds. Voila!

0 comments on commit 70e3a07

Please sign in to comment.