pug-php/pug-filter-less

将Less代码渲染为style标签中的编译后的CSS

1.1.0 2017-10-03 15:50 UTC

This package is auto-updated.

Last update: 2024-09-16 14:27:33 UTC


README

Latest Stable Version Build Status Code Climate Test Coverage StyleCI

此模板

//- 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

包含如下数据

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

将渲染为如下

<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>

安全联系信息

要报告安全漏洞,请使用Tidelift安全联系。Tidelift将协调修复和披露。