Skip to content
Render less code as compiled CSS in a style tag
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src/Pug/Filter
tests
.codeclimate.yml
.gitattributes
.gitignore
.styleci.yml
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml

README.md

pug-filter-less

Latest Stable Version Build Status Code Climate Test Coverage StyleCI

This template:

//- set from php controller
- $prev = $color

//- set in the pug template
- $color = 'red'

head
  :less
    @prev: yellow;
    p {
      width: 200px;
      color: #{color};
      a {
        color: #{prev};
      }
      em {
        color: @prev;
      }
    }
body
  p
    | I'm
    =color
    |  but my links are
    a=prev
    |  and my quotes are
    em=prev

with data like this:

$pug = new Pug();
$pug->render('template.pug', array(
    'color' => 'red',
));

will be rendered like this:

<head>
  <style type="text/css">
    p {
      color: red;
    }
    p a {
      color: yellow;
    }
    p em {
      color: yellow;
    }
  </style>
</head>
<body>
  <p>
    I'm red but my links are <a>yellow</a> and my quotes are <em>yellow</em>
  </p>
</body>
You can’t perform that action at this time.