Skip to content

Instantly share code, notes, and snippets.

@iromli
Created December 18, 2014 22:27
Show Gist options
  • Save iromli/d2ec3b08ef2255daf3b3 to your computer and use it in GitHub Desktop.
Save iromli/d2ec3b08ef2255daf3b3 to your computer and use it in GitHub Desktop.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
from webassets.filter import Filter
from webassets.filter import register_filter
class LibsassFilter(Filter):
name = "libsass"
def setup(self):
import sass
super(LibsassFilter, self).setup()
self.sassc = sass
def input(self, _in, out, **kwargs):
compiled = self.sassc.compile_string(six.binary_type(_in.read()))
out.write(compiled)
class JSXFilter(Filter):
name = "jsx"
def setup(self):
from react import jsx
super(JSXFilter, self).setup()
self.jsx = jsx
def input(self, _in, out, **kwargs):
compiled = self.jsx.transform_string(_in.read())
out.write(compiled)
register_filter(LibsassFilter)
register_filter(JSXFilter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment