kylekatarnls/jade-filter-stylus

该包已被废弃且不再维护。没有建议的替代包。

将 stylus 代码渲染为编译后的 CSS 代码块

2.0.0 2016-07-25 11:49 UTC

This package is auto-updated.

Last update: 2020-03-06 08:57:22 UTC


README

此存储库现在位于 https://github.com/pug-php/pug-filter-stylus

pug-filter-stylus

此模板

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

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

head
  :stylus
    prev = yellow
    p
      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>