• Stars
    star
    560
  • Rank 79,541 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 12 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A straightforward binding of libsass for Python. Compile Sass/SCSS in Python with no Ruby stack at all!

libsass-python: Sass/SCSS for Python

PyPI Build Status pre-commit.ci status

This package provides a simple Python extension module sass which is binding LibSass (written in C/C++ by Hampton Catlin and Aaron Leung). It's very straightforward and there isn't any headache related Python distribution/deployment. That means you can add just libsass into your setup.py's install_requires list or requirements.txt file. No need for Ruby nor Node.js.

It currently supports CPython 3.7+, and PyPy 3!

Features

  • You don't need any Ruby/Node.js stack at all, for development or deployment either.
  • Fast. (LibSass is written in C++.)
  • Simple API. See the below example code for details.
  • Custom functions.
  • @import callbacks.
  • Support both tabbed (Sass) and braces (SCSS) syntax.
  • WSGI middleware for ease of development. It automatically compiles Sass/SCSS files for each request.
  • setuptools/distutils integration. You can build all Sass/SCSS files using setup.py build_sass command.
  • Works also on PyPy.
  • Provides prebuilt wheel binaries for Linux, Windows, and Mac.

Install

It's available on PyPI, so you can install it using pip (or easy_install):

$ pip install libsass

Note

libsass requires some features introduced by the recent C++ standard. You need a C++ compiler that support those features. See also libsass project's README file.

Example

>>> import sass
>>> print sass.compile(string='a { b { color: blue; } }')
a b {
  color: blue; }

Docs

There's the user guide manual and the full API reference for libsass:

https://sass.github.io/libsass-python/

You can build the docs by yourself:

$ cd docs/
$ make html

The built docs will go to docs/_build/html/ directory.

Credit

Hong Minhee wrote this Python binding of LibSass.

Hampton Catlin and Aaron Leung wrote LibSass, which is portable C/C++ implementation of Sass.

Hampton Catlin originally designed Sass language and wrote the first reference implementation of it in Ruby.

The above three are all distributed under MIT license.

More Repositories

1

sass

Sass makes CSS fun!
TypeScript
15,081
star
2

node-sass

🌈 Node.js bindings to libsass
C++
8,506
star
3

libsass

A C/C++ implementation of a Sass compiler
C++
4,331
star
4

dart-sass

The reference implementation of Sass, written in Dart.
Dart
3,913
star
5

sassc

libsass command line driver
C
785
star
6

sassc-rails

Integrate SassC-Ruby with Rails!
HTML
707
star
7

sassc-ruby

Use libsass with Ruby!
Ruby
365
star
8

sass-site

Sass Website
TypeScript
312
star
9

node-sass-middleware

connect middleware extracted from node-sass
JavaScript
263
star
10

sass-spec

Official Sass Spec Suite
SCSS
200
star
11

ruby-sass

The original, now deprecated Ruby implementation of Sass
Ruby
181
star
12

embedded-host-node

A Node.js library that will communicate with Embedded Dart Sass using the Embedded Sass protocol
TypeScript
149
star
13

node-sass-binaries

Platform specific binaries for node-sass
127
star
14

libsass-net

A lightweight wrapper around libsass
C#
95
star
15

migrator

Tool for migrating stylesheets to new Sass versions
Dart
84
star
16

ruby-libsass

Ruby bindings for libsass
Ruby
81
star
17

dart-sass-embedded

A wrapper for Dart Sass that implements the compiler side of the Embedded Sass protocol
Dart
66
star
18

linter

An experimental Sass linter written using the Dart Sass AST
Dart
39
star
19

homebrew-sass

A Homebrew tap for Sass
Ruby
35
star
20

embedded-protocol

A protocol for communicating between a Sass implementation and a host language
31
star
21

perl-libsass

Perl bindings for libsass (CSS::Sass)
Perl
29
star
22

sass-registry

Extension registry for Sass
Ruby
7
star
23

libsass.com

CSS
6
star
24

sass-site-built

The built HTML of the Sass website, used to see output diffs in code reviews
HTML
6
star
25

clone-linked-repo

A utility action that emits information about one PR linked from another's message
Shell
3
star