Last active
April 25, 2017 15:50
-
-
Save daliborgogic/32f2b67f178c83e2ad03fada4dcf981d to your computer and use it in GitHub Desktop.
Pug filter stylus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
filters: { | |
stylus: function (str, opts) { | |
let ret | |
str = str.replace(/\\n /g, '') | |
const styl = require('stylus') | |
styl(str, opts).render(function (err, css) { | |
if (err) throw err | |
ret = css.replace(/\s/g, '') | |
}) | |
return '\n<style>' + ret + '</style>' | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype html | |
html(lang="en") | |
head | |
meta(charset="utf-8") | |
title Pug filter stylus | |
:stylus | |
.foo | |
color white | |
body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment