Skip to content

Instantly share code, notes, and snippets.

@daliborgogic
Last active April 25, 2017 15:50
Show Gist options
  • Save daliborgogic/32f2b67f178c83e2ad03fada4dcf981d to your computer and use it in GitHub Desktop.
Save daliborgogic/32f2b67f178c83e2ad03fada4dcf981d to your computer and use it in GitHub Desktop.
Pug filter stylus
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>'
}
}
}
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