示例#1
0
def test_pair_programmatic(scss_file_pair):
    scss_fn, css_fn, pytest_trigger = scss_file_pair

    if pytest_trigger is pytest.skip:
        pytest_trigger()

    with open(scss_fn) as fh:
        source = fh.read()
    try:
        with open(css_fn) as fh:
            expected = fh.read()
    except IOError:
        expected = ''

    directory, _ = os.path.split(scss_fn)
    include_dir = os.path.join(directory, 'include')
    scss.config.STATIC_ROOT = os.path.join(directory, 'static')

    try:
        compiler = scss.Scss(scss_opts=dict(style='expanded'),
                             search_paths=[include_dir, directory])
        actual = compiler.compile(source)
    except Exception:
        if pytest_trigger is pytest.xfail:
            pytest_trigger()
        raise

    # Normalize leading and trailing newlines
    actual = actual.strip('\n')
    expected = expected.strip('\n')

    if pytest_trigger is pytest.xfail:
        assert expected != actual
    else:
        assert expected == actual
示例#2
0
class __scss(AssetHandler):
    in_extensions = ["scss"]  # sass not quite yet supported
    out_extension = "css"
    css = pyScss.Scss()

    def compile_one(self, filename):
        return self.css.compile(open(filename, 'r').read())
示例#3
0
def scss(**conf):
    """
    (DEPRECATED) Render SCSS/SASS into CSS.  The input folder will be searched
    for *.scss files, which will be compiled to corresponding *.css files in
    the output directory.

    Note: This command will be removed in wq.app 2.0 in favor of
    Material UI themes.
    """
    compiler = pyScss.Scss(scss_opts={'compress': 0})
    logging.getLogger("scss").addHandler(logging.StreamHandler())

    def compile(path, source):
        css = compiler.compile(source)
        outfile = open(path, 'w')
        outfile.write(css)
        outfile.close()

    files = readfiles(conf['indir'], "scss")
    pyScss.config.LOAD_PATHS = [
        conf['indir'],
        os.path.join(conf['indir'], 'lib'),

        # FIXME: Why aren't these paths automatically picked up on Windows?
        os.path.join(conf['indir'], 'lib', 'compass'),
        os.path.join(conf['indir'], 'lib', 'compass', 'css3'),
    ]
    for name, source in files.items():
        if isinstance(source, dict):
            continue
        path = "%s/%s.css" % (conf['outdir'], name)
        compile(path, source)
        click.echo("%s compiled from %s/%s.scss" % (path, conf['indir'], name))
示例#4
0
def _init_scss():
    """ Initialize pyScss. """
    pyscss.STATIC_ROOT = STATIC_ROOT
    pyscss.STATIC_URL = settings.STATIC_URL
    pyscss.LOAD_PATHS = settings.SCSS_LOAD_PATHS

    return pyscss.Scss(scss_opts=settings.SCSS_OPTIONS)
示例#5
0
def compile(assets_dir, options):
    """Compile SCSS files if they have changed.

    Partly based on https://bitbucket.org/sjl/flask-lesscss

    """
    scss_paths = []
    compiler = scss.Scss(scss_opts=options)

    for path, subdirs, filenames in os.walk(assets_dir):
        scss_paths.extend([
            os.path.join(path, f) for f in filenames
            if os.path.splitext(f)[1] == '.scss' and not f.startswith('_')
        ])

    with chdir(assets_dir):
        for scss_path in scss_paths:
            css_path = os.path.splitext(scss_path)[0] + '.css'
            if not os.path.isfile(css_path):
                css_mtime = -1
            else:
                css_mtime = os.path.getmtime(css_path)

            if os.path.getmtime(scss_path) >= css_mtime:
                try:
                    compiled = compiler.compile(open(scss_path).read())
                    with open(css_path, 'w') as f:
                        f.write(compiled)
                    log.info('Compiled scss file: %s' % scss_path)
                except:
                    log.debug("Can't compile scss file: %s" % scss_path)
示例#6
0
def scss(**conf):
    """
    Render all SCSS/SASS files into CSS.  The input directory will be searched
    for *.scss files, which will be compiled to corresponding *.css files in
    the output directory.
    """
    import scss
    import logging
    compiler = scss.Scss(scss_opts={'compress': 0})
    logging.getLogger("scss").addHandler(logging.StreamHandler())

    def compile(path, source):
        css = compiler.compile(source)
        outfile = open(path, 'w')
        outfile.write(css)
        outfile.close()

    files = readfiles(conf['indir'], "scss")
    scss.config.LOAD_PATHS = [
        conf['indir'],
        os.path.join(conf['indir'], 'lib'),

        # FIXME: Why aren't these paths automatically picked up on Windows?
        os.path.join(conf['indir'], 'lib', 'compass'),
        os.path.join(conf['indir'], 'lib', 'compass', 'css3'),
    ]
    for name, source in files.items():
        if isinstance(source, dict):
            continue
        path = "%s/%s.css" % (conf['outdir'], name)
        compile(path, source)
        click.echo("%s compiled from %s/%s.scss" % (path, conf['indir'], name))
示例#7
0
    def run(self):
        '''Run build.'''
        try:
            import scss
        except ImportError:
            raise RuntimeError(
                'Error compiling sass files. Could not import "scss". '
                'Check you have the pyScss Python package installed.'
            )

        compiler = scss.Scss(
            search_paths=[self.sass_path]
        )

        themes = [
            'style_light',
            'style_dark'
        ]
        for theme in themes:
            scss_source = os.path.join(self.sass_path, '{0}.scss'.format(theme))
            css_target = os.path.join(self.css_path, '{0}.css'.format(theme))

            compiled = compiler.compile(
                scss_file=scss_source
            )
            with open(css_target, 'w') as file_handle:
                file_handle.write(compiled)
                print('Compiled {0}'.format(css_target))

        try:
            pyside_rcc_command = 'pyside-rcc'

            # On Windows, pyside-rcc is not automatically available on the
            # PATH so try to find it manually.
            if sys.platform == 'win32':
                import PySide
                pyside_rcc_command = os.path.join(
                    os.path.dirname(PySide.__file__),
                    'pyside-rcc.exe'
                )

            subprocess.check_call([
                pyside_rcc_command,
                '-o',
                self.resource_target_path,
                self.resource_source_path
            ])
        except (subprocess.CalledProcessError, OSError) as error:
            raise RuntimeError(
                'Error compiling resource.py using pyside-rcc. Possibly '
                'pyside-rcc could not be found. You might need to manually add '
                'it to your PATH. See README for more information.'
            )

        self._replace_imports_()
 def compile_file(self, content, path, force=False, outdated=False):
     add_to_scss_path(
         os.path.dirname(path))  # add the current path of the parsed
     # file to enable the local @import
     if force or outdated:
         self.save_file(
             path,
             scss.Scss(scss_opts={
                 'compress': False,
                 'debug_info': settings.DEBUG,
             }).compile(None, content))
示例#9
0
 def _css(self, preview, compress):
     css = StringIO()
     for style in self.styles:
         rev = style.preview_rev if (
             preview and style.preview_rev) else style.published_rev
         if compress:
             css.write(rev.compressed)
         else:
             css.write(scss.Scss().compile('@option compress:no;' +
                                           rev.raw))
     return css.getvalue()
示例#10
0
 def update(self, raw):
     self.raw = raw
     log = StringIO()
     handler = StreamHandler(log)
     handler.addFilter(ExceptionFilter())
     handler.setFormatter(
         Formatter(
             '<span class="level">%(levelname)s</span>: <span class="message">%(message)s</span><br />'
         ))
     scss.log.addHandler(handler)
     self.compressed = scss.Scss().compile(self.raw)
     scss.log.removeHandler(handler)
     handler.flush()
     self.put()
     return log.getvalue()
示例#11
0
def render_file(fullpath):
    with open(fullpath) as f:
        contents = f.read()

    extension = os.path.splitext(fullpath)[1][1:].lower()

    # SASS CSS
    if extension == 'scss':
        contents = Template(contents).render(Context({}))

        contents = scss.Scss(scss_opts={
            'compress': False,
        }).compile(contents)

    return contents
示例#12
0
def compress(content, file_type=None, arguments='', **kwargs):
    """

    :param content:
    :param file_type:
    :param arguments:
    :param kwargs:
    :return:
    """
    if file_type is None:
        print 'NO FILE TYPE. YUI COMPRESSOR WILL NOT RUN'
        return content

    if file_type.lower() == JS:
        compressor = _closure_compressor_args
    elif file_type.lower() == CSS:

        opts = {
            'compress': ('--compress' in arguments),
            'compress_short_colors': 0
        }
        if 'load_paths' in kwargs:
            opts['load_paths'] = kwargs.get('load_paths')

        _scss = scss.Scss(scss_opts=opts)
        output = _scss.compile(content)

        return output
    else:
        compressor = _html_compressor_args
        arguments = '--type=%s %s' % (file_type, arguments)

    command = 'nice %s %s' % (compressor, arguments)

    p = subprocess.Popen(command,
                         shell=True,
                         stdout=subprocess.PIPE,
                         stdin=subprocess.PIPE,
                         stderr=subprocess.PIPE)
    p.stdin.write(content)
    p.stdin.close()

    content = p.stdout.read()
    p.stdout.close()

    return content
示例#13
0
    def process_css(self, filename):

        # regular css
        if filename.endswith('.css'):
            css = open(filename).read()

        # scss support
        if filename.endswith('.scss'):
            _scss = scss.Scss()
            css = _scss.compile(scss_file=filename)

        # stylus support
        elif filename.endswith('.styl'):
            css = compile_stylus(filename)

        # less support
        elif filename.endswith('.less'):
            css = compile_less(filename)

        return css
示例#14
0
def create_css(fromdir, todir, *, debug):
    css_source_path = fromdir / 'style'
    if debug:
        scss_style = 'expanded'
    else:
        scss_style = 'compressed'
    scss_compiler = scss.Scss(
        search_paths=[str(css_source_path)],
        scss_opts={
            'debug_info': debug,
            'warn_unused': True,
            'style': scss_style,
        },
    )
    for name in 'style', 'loading':
        dest_filename = todir / (name + '.css')
        with (dest_filename).open('w') as cssfile:
            source_file = css_source_path / (name + '.scss')
            cssfile.write(scss_compiler.compile(scss_file=str(source_file)))
        yield StaticFile(dest_filename)
示例#15
0
def scss(conf):
    import scss
    import logging
    compiler = scss.Scss(scss_opts={'compress': 0})
    logging.getLogger("scss").addHandler(logging.StreamHandler())

    def compile(path, source):
        css = compiler.compile(source)
        outfile = open(path, 'w')
        outfile.write(css)
        outfile.close()

    if 'indir' in conf and 'outdir' in conf:
        files = readfiles(conf['indir'], "scss")
        scss.config.LOAD_PATHS = conf['indir']
        for name, source in files.iteritems():
            if isinstance(source, dict):
                continue
            path = "%s/%s.css" % (conf['outdir'], name)
            compile(path, source)
            print "%s compiled from %s/%s.scss" % (path, conf['indir'], name)
示例#16
0
        def stylesheets():
            scripts = [
                "stylesheets/table.scss",
            ]

            output = []
            sass = scss.Scss()
            for path in [
                    os.path.join(mod.root_path, "static", s) for s in scripts
            ]:
                output.append("/* CSS: %s*/\n" % path)
                if ".scss" in path:
                    logger.debug("Compiling Sass for %s " % path)
                    contents = sass.compile(scss_file=path)
                else:
                    with open(path) as f:
                        contents = f.read()

                output.append(contents)

            return Response("".join(output), mimetype="text/css")
示例#17
0
def test_pair_programmatic(scss_file_pair):
    scss_fn, css_fn = scss_file_pair

    with open(scss_fn) as fh:
        source = fh.read()
    try:
        with open(css_fn) as fh:
            expected = fh.read().decode('utf-8')
    except IOError:
        expected = ''

    directory, _ = os.path.split(scss_fn)
    include_dir = os.path.join(directory, 'include')
    scss.config.STATIC_ROOT = os.path.join(directory, 'static')

    compiler = scss.Scss(scss_opts=dict(style='expanded'),
                         search_paths=[include_dir, directory])
    actual = compiler.compile(source)

    # Normalize leading and trailing newlines
    actual = actual.strip('\n')
    expected = expected.strip('\n')

    assert expected == actual
示例#18
0
def prepare():
    if os.path.exists(app.static_folder):
        rmtree(app.static_folder)
    os.makedirs(app.static_folder)
    compiler = scss.Scss(
        scss_opts={'style': 'compressed' if not app.debug else None},
        search_paths=[os.path.join(os.getcwd(), 'styles')])

    # Compile styles (scss)
    d = os.walk('styles')
    for f in list(d)[0][2]:
        if os.path.splitext(f)[1] == ".scss":
            with open(os.path.join('styles', f)) as r:
                output = compiler.compile(r.read())

            parts = f.rsplit('.')
            css = '.'.join(parts[:-1]) + ".css"

            with open(os.path.join(app.static_folder, css), "w") as w:
                w.write(output)
                w.flush()
        else:
            copyfile(os.path.join('styles', f),
                     os.path.join(app.static_folder, f))

    # Compile scripts (coffeescript)
    d = os.walk('scripts')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('scripts', f)

        if os.path.splitext(f)[1] == ".js":
            copyfile(inputpath, outputpath)
        elif os.path.splitext(f)[1] == ".manifest":
            with open(inputpath) as r:
                manifest = r.read().split('\n')

            javascript = ''
            for script in manifest:
                script = script.strip(' ')

                if script == '' or script.startswith('#'):
                    continue

                bare = False
                if script.startswith('bare: '):
                    bare = True
                    script = script[6:]

                with open(os.path.join('scripts', script)) as r:
                    coffee = r.read().replace("{{ support_mail }}",
                                              _cfg('support-mail'))
                    if script.endswith('.js'):
                        javascript += coffee  # straight up copy
                    else:
                        javascript += coffeescript.compile(coffee, bare=bare)
            output = '.'.join(f.rsplit('.')[:-1]) + '.js'

            # TODO: Bug the slimit guys to support python 3
            #if not app.debug:
            #    javascript = minify(javascript)

            with open(os.path.join(app.static_folder, output), "w") as w:
                w.write(javascript)
                w.flush()

    d = os.walk('images')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('images', f)
        copyfile(inputpath, outputpath)
示例#19
0
from os import path
import logging
import scss

logging.basicConfig()

project_root = path.dirname(path.dirname(path.realpath(__file__)))

scss.config.LOAD_PATHS = [path.join(project_root, 'application/assets/scss')]

scss_compiler = scss.Scss()

compiled_css_from_file = scss_compiler.compile(scss_file=path.join(
    project_root,
    'application/assets/scss/manifest/performanceplatform-admin.scss'))

css_path = path.join(project_root,
                     'application/static/css/performanceplatform-admin.css')

with open(css_path, 'w') as file:
    file.write(compiled_css_from_file.encode('utf-8'))
示例#20
0
def prepare():
    path = tempfile.mkdtemp()

    compiler = scss.Scss(
        scss_opts={'style': 'compressed' if not app.debug else None})

    # Compile styles (scss)
    d = os.walk('styles')
    for f in list(d)[0][2]:
        if extension(f) == "scss":
            print("[scss] %s" % f)

            with open(os.path.join('styles', f)) as r:
                output = compiler.compile(r.read())

            parts = f.rsplit('.')
            css = '.'.join(parts[:-1]) + ".css"

            with open(os.path.join(path, css), "w") as w:
                w.write(output)
                w.flush()

    # Compile scripts (coffeescript)
    d = os.walk('scripts')
    preprocess = ['scripts/mediacrush.js']
    for f in list(d)[0][2]:
        outputpath = os.path.join(path, os.path.basename(f))
        inputpath = os.path.join('scripts', f)

        if extension(f) == "js":
            if inputpath in preprocess:
                with open(inputpath, "rb") as r:
                    output = r.read().decode("utf-8")
                    output = output.replace("{{ protocol }}", _cfg("protocol"))
                    output = output.replace("{{ domain }}", _cfg("domain"))

                with open(outputpath, "wb") as w:
                    w.write(output.encode("utf-8"))
                    w.flush()
            else:
                copyfile(inputpath, outputpath)

        elif extension(f) == "manifest":
            with open(inputpath, "rb") as r:
                manifest = r.read().decode("utf-8").split('\n')

            javascript = ''
            for script in manifest:
                script = script.strip(' ')

                if script == '' or script.startswith('#'):
                    continue

                bare = False
                if script.startswith('bare: '):
                    bare = True
                    script = script[6:]

                print("[coffee] %s" % script)
                with open(os.path.join('scripts', script)) as r:
                    coffee = r.read()
                    if script.endswith('.js'):
                        javascript += coffee  # straight up copy
                    else:
                        javascript += coffeescript.compile(coffee, bare=bare)
            output = '.'.join(f.rsplit('.')[:-1]) + '.js'

            if not app.debug:
                # FIXME https://github.com/rspivak/slimit/issues/64
                if sys.version_info.major == 3:
                    sys.stderr.write(
                        "WARNING: Minifying is not supported on Python 3 yet\n"
                    )
                else:
                    javascript = minify(javascript)

            with open(os.path.join(path, output), "wb") as w:
                w.write(javascript.encode("utf-8"))
                w.flush()

    if os.path.exists(app.static_folder):
        rmtree(app.static_folder)
    os.makedirs(app.static_folder)

    d = os.walk(path)
    for f in list(d)[0][2]:
        inputpath = os.path.join(path, os.path.basename(f))
        outputpath = os.path.join(app.static_folder, f)
        copyfile(inputpath, outputpath)

    d = os.walk('images')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('images', f)
        copyfile(inputpath, outputpath)
示例#21
0
文件: scss.py 项目: dag/rag
 def compiler(self):
     compiler = scss.Scss()
     compiler.scss_opts.update(compress=self.compress)
     return compiler
示例#22
0
def prepare():
    if os.path.exists(app.static_folder):
        rmtree(app.static_folder)
    os.makedirs(app.static_folder)
    compiler = scss.Scss(
        scss_opts={'style': 'compressed' if not app.debug else None})

    # Compile styles (scss)
    d = os.walk('styles')
    for f in list(d)[0][2]:
        if extension(f) == "scss":
            with open(os.path.join('styles', f)) as r:
                output = compiler.compile(r.read())

            parts = f.rsplit('.')
            css = '.'.join(parts[:-1]) + ".css"

            with open(os.path.join(app.static_folder, css), "w") as w:
                w.write(output)
                w.flush()

    # Compile scripts (coffeescript)
    d = os.walk('scripts')
    preprocess = ['scripts/mediacrush.js']
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('scripts', f)

        if extension(f) == "js":
            if inputpath in preprocess:
                with open(inputpath) as r:
                    output = r.read().decode("utf-8")
                    output = output.replace("{{ protocol }}", _cfg("protocol"))
                    output = output.replace("{{ domain }}", _cfg("domain"))

                with open(outputpath, "w") as w:
                    w.write(output.encode("utf-8"))
                    w.flush()
            else:
                copyfile(inputpath, outputpath)

        elif extension(f) == "manifest":
            with open(inputpath) as r:
                manifest = r.read().decode("utf-8").split('\n')

            javascript = ''
            for script in manifest:
                script = script.strip(' ')

                if script == '' or script.startswith('#'):
                    continue

                bare = False
                if script.startswith('bare: '):
                    bare = True
                    script = script[6:]

                with open(os.path.join('scripts', script)) as r:
                    coffee = r.read()
                    if script.endswith('.js'):
                        javascript += coffee  # straight up copy
                    else:
                        javascript += coffeescript.compile(coffee, bare=bare)
            output = '.'.join(f.rsplit('.')[:-1]) + '.js'

            if not app.debug:
                javascript = minify(javascript)

            with open(os.path.join(app.static_folder, output), "w") as w:
                w.write(javascript.encode("utf-8"))
                w.flush()

    d = os.walk('images')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('images', f)
        copyfile(inputpath, outputpath)
示例#23
0
 def compile_file(self, content, path, force=False, outdated=False):
     add_to_scss_path(
         os.path.dirname(path)
     )  # add the current path of the parsed file to enable the local @import
     if force or outdated:
         self.save_file(path, scss.Scss().compile(None, content))
示例#24
0
def prepare():
    path = tempfile.mkdtemp()

    compiler = scss.Scss(
        scss_opts={"style": "compressed" if not app.debug else None})

    # Unsafe extnsion function used only here
    extension = lambda f: f.rsplit(".", 1)[1].lower()

    # Compile styles (scss)
    d = os.walk("styles")
    for f in list(d)[0][2]:
        if extension(f) == "scss":
            print(("[scss] %s" % f))

            with open(os.path.join("styles", f)) as r:
                output = compiler.compile(r.read())

            parts = f.rsplit(".")
            css = ".".join(parts[:-1]) + ".css"

            with open(os.path.join(path, css), "w") as w:
                w.write(output)
                w.flush()

    # Compile scripts (coffeescript)
    d = os.walk("scripts")
    preprocess = ["scripts/mediacrush.js"]
    for f in list(d)[0][2]:
        outputpath = os.path.join(path, os.path.basename(f))
        inputpath = os.path.join("scripts", f)

        if extension(f) == "js":
            if inputpath in preprocess:
                with open(inputpath) as r:
                    output = r.read()
                    output = output.replace("{{ protocol }}", _cfg("protocol"))
                    output = output.replace("{{ domain }}", _cfg("domain"))

                with open(outputpath, "w") as w:
                    w.write(output)
                    w.flush()
            else:
                copyfile(inputpath, outputpath)

        elif extension(f) == "manifest":
            with open(inputpath) as r:
                manifest = r.read().split("\n")

            javascript = ""
            for script in manifest:
                script = script.strip(" ")

                if script == "" or script.startswith("#"):
                    continue

                bare = False
                if script.startswith("bare: "):
                    bare = True
                    script = script[6:]

                print(("[coffee] %s" % script))
                with open(os.path.join("scripts", script)) as r:
                    coffee = r.read()
                    if script.endswith(".js"):
                        javascript += coffee  # straight up copy
                    else:
                        javascript += coffeescript.compile(coffee, bare=bare)
            output = ".".join(f.rsplit(".")[:-1]) + ".js"

            with open(os.path.join(path, output), "w") as w:
                w.write(javascript)
                w.flush()

    if os.path.exists(app.static_folder):
        rmtree(app.static_folder)
    os.makedirs(app.static_folder)

    d = os.walk(path)
    for f in list(d)[0][2]:
        inputpath = os.path.join(path, os.path.basename(f))
        outputpath = os.path.join(app.static_folder, f)
        copyfile(inputpath, outputpath)

    d = os.walk("images")
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join("images", f)
        copyfile(inputpath, outputpath)
示例#25
0
            del page['subpages']

        checksum = md5(final_text.encode('utf-8')).digest()
        if checksum == get_dict_val(page, 'checksum'):
            if os.path.isfile(out_f):
                continue

        write_text(out_f, final_text)
        page['checksum'] = checksum
        logger.info('compiled .html: "{0}" -> "{1}"'.format(
            relpath(page['filename']), relpath(out_f)))


# transfer functions to copy the static directory

_scss_compiler = scss.Scss(scss_opts={'style': 'expanded'})


def scss_to_css(src, dst_dir, site):
    dst = os.path.join(dst_dir, os.path.basename(src))
    dst = os.path.splitext(dst)[0] + '.css'
    if not has_extensions(src, '.sass', '.scss'):
        return False
    if not site['force'] and is_uptodate(src, dst):
        return False
    if has_extensions(src, '.sass'):
        sass_text = read_text(src)
        scss_text = sassin.compile(sass_text)
    else:
        scss_text = read_text(src)
    try:
示例#26
0
#!/usr/bin/env python
# -*- coding: utf-8 -*- #

from os.path import join, dirname, exists
import scss

scss.config.PROJECT_ROOT = dirname(__file__)
scss.config.LOAD_PATHS = dirname(__file__)

_scss = scss.Scss(
    #scss_opts={
    #  'compress': True,
    #  'debug_info': True,
    #}
)

compiled_css_from_file = _scss.compile(
    scss_file=join(dirname(__file__), 'grid.scss'))
print(compiled_css_from_file)

output_path = join(dirname(__file__), 'all.css')
with open(output_path, 'w') as f:
    f.write(compiled_css_from_file)
示例#27
0
- view rendered on the client by Mithril.js
- ZeroMQ pub-sub data
- data becomes JSON
  - some is stream over WebSockets to front-end
  - some is plain-jain JSON

Nice: The worst part is that I can't tell if I'm a genius, or Don Music.
(That was a Sesame Street reference).
"""

import os
from random import choice
import tornado.web
import tornado.ioloop
import scss
Scss = scss.Scss()

from squidwork.config import Service
from squidwork.sender import MessageEncoder
from squidwork import Message
from squidwork.quick import sub
from squidwork.async import AsyncReciever
from squidwork.web import handlers as api_handlers
from squidwork.web import Config
from squidwork.web.handlers import (
    JSONHandler, CoffeescriptHandler,
    TemplateRenderer)


class Cache(object):
    """
示例#28
0
 def __init__(self, *args, **kwargs):
     super(SCSSParser, self).__init__(*args, **kwargs)
     self.parser = scss.Scss()
     self.parser._scss_opts['compress'] = self.compress