项目作者: pug-php

项目描述 :
Render stylus code as compiled CSS in a style tag
高级语言: PHP
项目地址: git://github.com/pug-php/pug-filter-stylus.git
创建时间: 2016-06-23T14:33:12Z
项目社区:https://github.com/pug-php/pug-filter-stylus

开源协议:MIT License

下载


pug-filter-stylus

Latest Stable Version
Build Status
Code Climate
Test Coverage
StyleCI

This template:

  1. //- set from php controller
  2. - $prev = $color
  3. //- set in the pug template
  4. - $color = 'red'
  5. head
  6. :stylus
  7. prev = yellow
  8. p
  9. color #{color}
  10. a
  11. color #{prev}
  12. em
  13. color prev
  14. body
  15. p
  16. | I'm
  17. =color
  18. | but my links are
  19. a=prev
  20. | and my quotes are
  21. em=prev

with data like this:

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

will be rendered like this:

  1. <head>
  2. <style type="text/css">
  3. p {
  4. color: red;
  5. }
  6. p a {
  7. color: yellow;
  8. }
  9. p em {
  10. color: yellow;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <p>
  16. I'm red but my links are <a>yellow</a> and my quotes are <em>yellow</em>
  17. </p>
  18. </body>