1PYSASSC(1)                          libsass                         PYSASSC(1)
2
3
4

NAME

6       pysassc - libsass Documentation
7
8       This  package  provides  a simple Python extension module sass which is
9       binding LibSass (written in C/C++ by Hampton Catlin and  Aaron  Leung).
10       It's  very  straightforward and there isn't any headache related Python
11       distribution/deployment.  That means you can add just libsass into your
12       setup.py's install_requires list or requirements.txt file.
13
14       It currently supports CPython 2.6, 2.7, 3.5--3.7, and PyPy 2.3+!
15

FEATURES

17       · You  don't  need  any  Ruby/Node.js  stack at all, for development or
18         deployment either.
19
20       · Fast. (LibSass is written in C++.)
21
22       · Simple API.  See example code for details.
23
24       · Custom functions.
25
26       · @import callbacks.
27
28       · Support both tabbed (Sass) and braces (SCSS) syntax.
29
30       · WSGI middleware for ease of development.  It  automatically  compiles
31         Sass/SCSS  files  for  each  request.   See  also  sassutils.wsgi for
32         details.
33
34       · setuptools/distutils integration.  You can build all Sass/SCSS  files
35         using  setup.py build_sass command.  See also sassutils.distutils for
36         details.
37
38       · Works also on PyPy.
39
40       · Provides prebuilt wheel (PEP 427) binaries for Windows and Mac.
41

INSTALL

43       It's available on PyPI, so you can install it using pip:
44
45          $ pip install libsass
46
47       NOTE:
48          libsass requires some features introduced by the  recent  C++  stan‐
49          dard.   You  need  a  C++ compiler that support those features.  See
50          also libsass project's README file.
51

EXAMPLES

53   Compile a String of Sass to CSS
54       >>> import sass
55       >>> sass.compile(string='a { b { color: blue; } }')
56       'a b {\n  color: blue; }\n'
57
58   Compile a Directory of Sass Files to CSS
59       >>> import sass
60       >>> import os
61       >>> os.mkdir('css')
62       >>> os.mkdir('sass')
63       >>> scss = """\
64       ... $theme_color: #cc0000;
65       ... body {
66       ...     background-color: $theme_color;
67       ... }
68       ... """
69       >>> with open('sass/example.scss', 'w') as example_scss:
70       ...      example_scss.write(scss)
71       ...
72       >>> sass.compile(dirname=('sass', 'css'), output_style='compressed')
73       >>> with open('css/example.css') as example_css:
74       ...     print(example_css.read())
75       ...
76       body{background-color:#c00}
77

USER'S GUIDE

79   Using with Flask
80       This guide explains how to use libsass with the  Flask  web  framework.
81       sassutils  package  provides  several tools that can be integrated into
82       web applications written in Flask.
83
84   Contents
85       · Using with Flask
86
87         · Directory layout
88
89         · Defining manifest
90
91         · Building Sass/SCSS for each request
92
93         · Building Sass/SCSS for each deployment
94
95   Directory layout
96       Imagine the project contained in such directory layout:
97
98       · setup.py
99
100       · myapp/
101
102         · __init__.py
103
104         · static/
105
106           · sass/
107
108           · css/
109
110         · templates/
111
112       Sass/SCSS files will go inside myapp/static/sass/ directory.   Compiled
113       CSS files will go inside myapp/static/css/ directory.  CSS files can be
114       regenerated, so add myapp/static/css/ into your ignore list like  .git‐
115       ignore or .hgignore.
116
117   Defining manifest
118       The  sassutils defines a concept named manifest.  Manifest is the build
119       settings of Sass/SCSS.  It specifies some  paths  related  to  building
120       Sass/SCSS:
121
122       · The path of the directory which contains Sass/SCSS source files.
123
124       · The path of the directory which the compiled CSS files will go.
125
126       · The  path, exposed to HTTP (through WSGI), of the directory that will
127         contain the compiled CSS files.
128
129       Every package may have its own manifest.  Paths have to be relative  to
130       the path of the package.
131
132       For example, in the above project, the package name is myapp.  The path
133       of the package is myapp/.  The  path  of  the  Sass/SCSS  directory  is
134       static/sass/  (relative to the package directory).  The path of the CSS
135       directory is static/css/.  The exposed path is /static/css.
136
137       These settings can be represented as the following manifests:
138
139          {
140              'myapp': ('static/sass', 'static/css', '/static/css')
141          }
142
143       As you can see the above, the set of manifests are represented in  dic‐
144       tionary, in which the keys are packages names and the values are tuples
145       of paths.
146
147   Building Sass/SCSS for each request
148       SEE ALSO:
149
150          Flask --- Hooking in WSGI Middlewares
151                 The section which explains how to integrate WSGI  middlewares
152                 to Flask.
153
154          Flask --- flask:app-dispatch
155                 The  documentation  which  explains how Flask dispatches each
156                 request internally.
157
158       In development, manually building Sass/SCSS files for each change is  a
159       tedious task.  SassMiddleware makes the web application build Sass/SCSS
160       files for each request automatically.  It's a WSGI  middleware,  so  it
161       can be plugged into the web app written in Flask.
162
163       SassMiddleware takes two required parameters:
164
165       · The WSGI-compliant callable object.
166
167       · The set of manifests represented as a dictionary.
168
169       So:
170
171          from flask import Flask
172          from sassutils.wsgi import SassMiddleware
173
174          app = Flask(__name__)
175
176          app.wsgi_app = SassMiddleware(app.wsgi_app, {
177              'myapp': ('static/sass', 'static/css', '/static/css')
178          })
179
180       And  then,  if  you want to link a compiled CSS file, use the url_for()
181       function:
182
183          <link href="{{ url_for('static', filename='css/style.scss.css') }}"
184                rel="stylesheet" type="text/css">
185
186       NOTE:
187          The linked filename is style.scss.css,  not  just  style.scss.   All
188          compiled filenames have trailing .css suffix.
189
190   Building Sass/SCSS for each deployment
191       NOTE:
192          This section assumes that you use setuptools for deployment.
193
194       SEE ALSO:
195
196          Flask --- flask:distribute-deployment
197                 How to deploy Flask application using setuptools.
198
199       If  libsass  is  installed in the site-packages (for example, your vir‐
200       tualenv), the setup.py script also gets a new command provided by  lib‐
201       sass: build_sass.  The command is aware of the sass_manifests option of
202       setup.py and builds all Sass/SCSS sources according to the manifests.
203
204       Add these arguments to setup.py script:
205
206          setup(
207              # ...,
208              setup_requires=['libsass >= 0.6.0'],
209              sass_manifests={
210                  'myapp': ('static/sass', 'static/css', '/static/css')
211              }
212          )
213
214       The setup_requires option makes  sure  that  libsass  is  installed  in
215       site-packages  (for  example,  your  virtualenv)  before  the  setup.py
216       script.  That means if you run the setup.py script  and  libsass  isn't
217       installed in advance, it will automatically install libsass first.
218
219       The sass_manifests specifies the manifests for libsass.
220
221       Now  setup.py build_sass will compile all Sass/SCSS files in the speci‐
222       fied path and generates compiled CSS files inside  the  specified  path
223       (according to the manifests).
224
225       If  you  use  it  with sdist or bdist commands, the packed archive will
226       also contain the compiled CSS files!
227
228          $ python setup.py build_sass sdist
229
230       You can add aliases to make these commands always  run  the  build_sass
231       command first.  Make setup.cfg config:
232
233          [aliases]
234          sdist = build_sass sdist
235          bdist = build_sass bdist
236
237       Now  it automatically builds Sass/SCSS sources and include the compiled
238       CSS files to the package archive when you run setup.py sdist.
239
240   Changelog
241   Version 0.20.0
242       Released on November 3, 2019.
243
244       · Produce abi3 wheels on macos / linux [#307 by Anthony Sottile]
245
246       · Follow up the libsass upstream: 3.6.4 --- See the  release  notes  of
247         LibSass 3.6.4. [#313 by Anthony Sottile]
248
249   Version 0.19.4
250       Released on November 3, 2019.
251
252       · Follow  up  the  libsass upstream: 3.6.3 --- See the release notes of
253         LibSass 3.6.3. [#304 by Anthony Sottile]
254
255   Version 0.19.3
256       Released on October 5, 2019.
257
258       · Follow up the libsass upstream: 3.6.2 --- See the  release  notes  of
259         LibSass 3.6.2. [#302 by Anthony Sottile]
260
261   Version 0.19.2
262       Released on June 16, 2019.
263
264       · Follow  up  the  libsass upstream: 3.6.1 --- See the release notes of
265         LibSass 3.6.1. [#298 by Anthony Sottile]
266
267   Version 0.19.1
268       Released on May 18, 2019.
269
270       · Re-release of 0.19.0 with windows python2.7 wheels [#297  by  Anthony
271         Sottile]
272
273   Version 0.19.0
274       Released on May 18, 2019.
275
276       · Follow  up  the  libsass upstream: 3.6.0 --- See the release notes of
277         LibSass 3.6.0. [#295 by Anthony Sottile]
278
279   Version 0.18.0
280       Release on March 13, 2019
281
282       · Add support for previous import path to importer callbacks [#287 #291
283         by Frankie Dintino]
284
285   Version 0.17.0
286       Release on January 03, 2019
287
288       ·
289
290         Add several new cli options [#279 #268 by Frankie Dintino]
291
292                · --sourcemap-file: output file for source map
293
294                · --sourcemap-contents: embed sourcesContent in source map
295
296                · --sourcemap-embed: embed sourceMappingURL as data uri
297
298                · --omit-sourcemap-url:  omit source map url comment from out‐
299                  put
300
301                · --sourcemap-root: base path, emitted as sourceRoot in source
302                  map
303
304       · Fix .sass in WsgiMiddleware (again) [#280 by Anthony Sottile]
305
306   Version 0.16.1
307       Released on November 25, 2018.
308
309       · Fix compilation on macos mojave [#276 #277 by Anthony Sottile]
310
311       · Fix .sass in WsgiMiddleware for strip_extension=True [#278 by Anthony
312         Sottile]
313
314   Version 0.16.0
315       Released on November 13, 2018.
316
317       · Use -lc++ link flag when compiling  with  clang  [#270  by  Christian
318         Thieme #271 by Anthony Sottile]
319
320       · Honor strip_extension in SassMiddleware [#274 by Anthony Sottile]
321
322       · Follow  up  the  libsass upstream: 3.5.5 --- See the release notes of
323         LibSass 3.5.5. [#275 by Anthony Sottile]
324
325   Version 0.15.1
326       Released on September 24, 2018.
327
328       · Fix setup.py sdist (regressed in 0.15.0) [#267 by Anthony Sottile]
329
330   Version 0.15.0
331       Released on September 16, 2018.
332
333       · Fix invalid escape sequences [#249 by Anthony Sottile]
334
335       · Add code of conduct [#251 by Nick Schonning]
336
337       · Add support for python3.7 and remove testing for python3.4  [#254  by
338         Anthony Sottile]
339
340       · Add  strip_extension option for wsgi / distutils builder [#55 #258 by
341         Anthony Sottile #260 by Morten Brekkevold]
342
343       · Deprecate sassc (replaced by pysassc).  [#262 by Anthony Sottile]
344
345       · Import abc classes from collections.abc to remove  DeprecationWarning
346         [#264 by Gary van der Merwe #265 by Anthony Sottile]
347
348   Version 0.14.5
349       Released on April 25, 2018.
350
351       · Follow  up  the  libsass upstream: 3.5.4 --- See the release notes of
352         LibSass 3.5.4. [#247 by Anthony Sottile]
353
354   Version 0.14.4
355       Released on April 24, 2018.
356
357       · Add ability to specify imports for custom extensions.  This  provides
358         a  way  to enable imports of .css files (which was removed in 3.5.3).
359         Specify --import-extensions .css to restore  the  previous  behavior.
360         [#246 by Samuel Colvin]
361
362   Version 0.14.3
363       Released on April 23, 2018.
364
365       · Follow  up  the  libsass upstream: 3.5.3 --- See the release notes of
366         LibSass 3.5.3. [#244 by Anthony Sottile]
367
368   Version 0.14.2
369       Released on March 16, 2018.
370
371       · Follow up the libsass upstream: 3.5.2 --- See the  release  notes  of
372         LibSass 3.5.2. [#243 by Anthony Sottile]
373
374   Version 0.14.1
375       Released on March 12, 2018.
376
377       · Follow  up  the  libsass upstream: 3.5.1 --- See the release notes of
378         LibSass 3.5.1. [#242 by Anthony Sottile]
379
380   Version 0.14.0
381       Released on March 6, 2018.
382
383       · Follow up the libsass upstream: 3.5.0 --- See the  release  notes  of
384         LibSass 3.5.0. [#241 by Anthony Sottile]
385
386       · SassList  type  gained  an additional option bracketed=False to match
387         the upstream changes to the sass_list type. [#184 by Anthony Sottile]
388
389   Version 0.13.7
390       Released on February 5, 2018.
391
392       · Follow up the libsass upstream: 3.4.9 --- See the  release  notes  of
393         LibSass 3.4.9. [#232 by Anthony Sottile]
394
395   Version 0.13.6
396       Released on January 19, 2018.
397
398       · libsass-python has moved to the sass organization!
399
400   Version 0.13.5
401       Released on January 11, 2018.
402
403       · Follow  up  the  libsass upstream: 3.4.8 --- See the release notes of
404         LibSass 3.4.8. [#228 by Anthony Sottile]
405
406   Version 0.13.4
407       Released on November 14, 2017.
408
409       · Follow up the libsass upstream: 3.4.7 --- See the  release  notes  of
410         LibSass 3.4.7. [#226 by Anthony Sottile]
411
412   Version 0.13.3
413       Released on October 11, 2017.
414
415       · Sort input files for determinism [#212 by Bernhard M. Wiedemann]
416
417       · Include LICENSE file in distributions [#216 by Dougal J. Sutherland]
418
419       · Add a pysassc entry to replace sassc [#218 by Anthony Sottile]
420
421       · Enable building with dynamic linking [#219 by Marcel Plch]
422
423       · Follow  up  the  libsass upstream: 3.4.6 --- See the release notes of
424         LibSass 3.4.6. [#221 by Anthony Sottile]
425
426   Version 0.13.2
427       Released on June 14, 2017.
428
429       · Always add cwd to import paths [#208 by Anthony Sottile]
430
431   Version 0.13.1
432       Released on June 8, 2017.
433
434       · Follow up the libsass upstream: 3.4.5 --- See the  release  notes  of
435         LibSass 3.4.5. [#207 by Anthony Sottile]
436
437   Version 0.13.0
438       Released on June 7, 2017.
439
440       · Use getfullargspec when available in python 3. [#188 by Thom Wiggers]
441
442       · Use  sass_copy_c_string  instead  of  strdup for portability [#196 by
443         Anthony Sottile]
444
445       · Use -std=gnu++0x to fix  installation  under  cygwin  [#195  #197  by
446         Anthony Sottile]
447
448       · Correct source map url [#201 #202 by Anthony Sottile]
449
450       · Remove --watch [#203 by Anthony Sottile]
451
452       · Follow  up  the  libsass upstream: 3.4.4 --- See the release notes of
453         LibSass 3.4.4. [#205 by Anthony Sottile]
454
455   Version 0.12.3
456       Released on January 7, 2017.
457
458       · Follow up the libsass upstream: 3.4.3 --- See the  release  notes  of
459         LibSass 3.4.3. [#178 by Anthony Sottile]
460
461   Version 0.12.2
462       Released on January 5, 2017.
463
464       · Follow  up  the  libsass upstream: 3.4.2 --- See the release notes of
465         LibSass 3.4.2. [#176 by Anthony Sottile]
466
467   Version 0.12.1
468       Released on December 20, 2016.
469
470       · Follow up the libsass upstream: 3.4.1 --- See the  release  notes  of
471         LibSass 3.4.1. [#175 by Anthony Sottile]
472
473   Version 0.12.0
474       Released on December 10, 2016.
475
476       · Follow  up  the  libsass upstream: 3.4.0 --- See the release notes of
477         LibSass 3.4.0. [#173 by Anthony Sottile]
478
479   Version 0.11.2
480       Released on October 24, 2016.
481
482       · Drop support for python2.6 [#158 by Anthony Sottile]
483
484       · Deprecate --watch [#156 by Anthony Sottile]
485
486       · Preserve line endings [#160 by Anthony Sottile]
487
488       · Follow up the libsass upstream: 3.3.6 --- See the  release  notes  of
489         LibSass 3.3.6. [#167 by Anthony Sottile]
490
491   Version 0.11.1
492       Released on April 22, 2016.
493
494       · Follow  up  the  libsass upstream: 3.3.5 --- See the release notes of
495         LibSass 3.3.5. [#148 by Anthony Sottile]
496
497   Version 0.11.0
498       Released on March 23, 2016.
499
500       · Follow up the libsass upstream: 3.3.4 --- See the  release  notes  of
501         LibSass 3.3.4. [#144 by Anthony Sottile]
502
503       · Expose libsass version in sassc --version and sass.libsass_version [‐
504         #142 #141 #140 by Anthony Sottile]
505
506       · Fix warning about unused enum on switch [#127 #131  by  Anthony  Sot‐
507         tile]
508
509       · Sourcemaps no longer imply source comments [#124 #130 by Tim Tisdall]
510
511       · Add --source-comments option to sassc [#124 #130 by Anthony Sottile]
512
513       · Improve  formatting  of  CompileError  under python3 [#123 by Anthony
514         Sottile]
515
516       · Raise when compiling a directory which does not exist [#116  #119  by
517         Anthony Sottile]
518
519   Version 0.10.1
520       Released on January 29, 2016.
521
522       · Follow  up  the  libsass upstream: 3.3.3 --- See the release notes of
523         LibSass 3.3.3. [by Anthony Sottile]
524
525       · Allow -t for style like sassc [#98 by Anthony Sottile]
526
527   Version 0.10.0
528       Released on December 15, 2015.
529
530       · Support custom import callbacks [#81  by  Alice  Zoë  Bevan–McGregor,
531         Anthony Sottile]
532
533       · Disallow arbitrary kwargs in compile() [#109 by Anthony Sottile]
534
535   Version 0.9.3
536       Released on December 03, 2015.
537
538       · Support "indented" Sass compilation [#41 by Alice Zoë Bevan–McGregor]
539
540       · Fix wheels on windows [#28 #49 by Anthony Sottile]
541
542   Version 0.9.2
543       Released on November 12, 2015.
544
545       · Follow  up  the  libsass upstream: 3.3.2 --- See the release notes of
546         LibSass 3.3.2. [by Anthony Sottile]
547
548       · Require VS 2015 to build on windows [#99 by Anthony Sottile]
549
550   Version 0.9.1
551       Released on October 29, 2015.
552
553       · Follow up the libsass upstream: 3.3.1 --- See the  release  notes  of
554         LibSass 3.3.1. [by Anthony Sottile]
555
556   Version 0.9.0
557       Released on October 28, 2015.
558
559       · Fix a bug with writing UTF-8 to a file [#72 by Caleb Ely]
560
561       · Fix a segmentation fault on ^C [#87 by Anthony Sottile]
562
563       · Follow  up  the  libsass upstream: 3.3.0 --- See the release notes of
564         LibSass 3.3.0. [#96 by Anthony Sottile]
565
566   Version 0.8.3
567       Released on August 2, 2015.
568
569       · Follow up the libsass upstream: 3.2.5 --- See the  release  notes  of
570         LibSass 3.2.5.  [#79, #80 by Anthony Sottile]
571
572       · Fixed  a  bug  that  *.sass  files  were  ignored.   [#78  by Guilhem
573         MAS-PAITRAULT]
574
575   Version 0.8.2
576       Released on May 19, 2015.
577
578       · Follow up the libsass upstream: 3.2.4 --- See the  release  notes  of
579         LibSass 3.2.3, and 3.2.4.  [#69 by Anthony Sottile]
580
581       · The  default  value  of  SassMiddleware's  error_status parameter was
582         changed from '500 Internal Server Error' to '200 OK' so that  Mozilla
583         Firefox can render the error message well.  [#67, #68, #70 by zxv]
584
585   Version 0.8.1
586       Released on May 14, 2015.
587
588       · Fixed  a  bug  that there was no 'expanded' in sass.OUTPUT_STYLES but
589         'expected' instead which is a typo.  [#66 by Triangle717]
590
591       · Fixed broken FreeBSD build.  [#65 by Toshiharu Moriyama]
592
593   Version 0.8.0
594       Released on May 3, 2015.
595
596       · Follow up the libsass upstream: 3.2.2 --- See the  release  notes  of
597         LibSass  3.2.0,  3.2.1,  and 3.2.2.  [#61, #52, #56, #58, #62, #64 by
598         Anthony Sottile]
599
600         · Compact and expanded output styles  [#37]
601
602         · Strings and interpolation closer to Ruby Sass
603
604         · The correctness of the generated sourcemap files
605
606         · Directive buddling
607
608         · Full support for the @at-root directive
609
610         · Full support for !global variable scoping
611
612       · Now underscored files are ignored when compiling a  directory.   [#57
613         by Anthony Sottile]
614
615       · Fixed broken FreeBSD build.  [#34, #60 by Ilya Baryshev]
616
617       · SassMiddleware  became  to log syntax errors if exist during compila‐
618         tion to sassutils.wsgi.SassMiddleware logger with level ERROR.  [#42]
619
620   Version 0.7.0
621       Released on March 6, 2015.
622
623       Anthony Sottile contributed to the most of this release.   Huge  thanks
624       to him!
625
626       · Follow  up  the  libsass  upstream: 3.1.0 --- See the release note of
627         LibSass.  [#38, #43 by Anthony Sottile]
628
629         · Custom functions and imports
630
631         · Decrementing in @for loops
632
633         · @debug and @error
634
635         · not operator
636
637         · nth() for maps
638
639         · inspect()
640
641         · feature-exists()
642
643         · unique-id()
644
645         · random()
646
647       · Added custom functions support.  [#13, #44 by Anthony Sottile]
648
649         · Added sass.SassFunction class.
650
651         · Added custom_functions parameter to sass.compile() function.
652
653         · Added data types for custom functions:
654
655           · sass.SassNumber
656
657           · sass.SassColor
658
659           · sass.SassList
660
661           · sass.SassMap
662
663           · sass.SassError
664
665           · sass.SassWarning
666
667       · Added precision parameter to sass.compile() function.  [#39 by Andrea
668         Stagi]
669
670       · sassc has a new -p/--precision option.  [#39 by Andrea Stagi]
671
672   Version 0.6.2
673       Released on November 25, 2014.
674
675       Although  0.6.0--0.6.1 have needed GCC (G++) 4.8+, LLVM Clang 3.3+, now
676       it became back to only need GCC (G++) 4.6+, LLVM Clang 2.9+, or  Visual
677       Studio 2013 Update 4+.
678
679       · Follow  up  the  libsass  upstream: 3.0.2 --- See the release note of
680         libsass.  [#33 by Rodolphe Pelloux-Prayer]
681
682       · Fixed a bug that sassc --watch crashed when a file is not  compilable
683         on the first try.  [#32 by Alan Justino da Silva]
684
685       · Fixed broken build on Windows.
686
687   Version 0.6.1
688       Released on November 6, 2014.
689
690       · Follow  up  the  libsass  upstream: 3.0.1 --- See the release note of
691         LibSass.
692
693       · Fixed a bug that SassMiddleware never closes the socket on some  WSGI
694         servers e.g. eventlet.wsgi.
695
696   Version 0.6.0
697       Released on October 27, 2014.
698
699       Note  that  since  libsass-python  0.6.0  (and libsass 3.0) it requires
700       C++11 to compile.  Although 0.6.2 became back to only  need  GCC  (G++)
701       4.6+,  LLVM  Clang  2.9+,  from 0.6.0 to 0.6.1 you need GCC (G++) 4.8+,
702       LLVM Clang 3.3+, or Visual Studio 2013 Update 4+.
703
704       · Follow up the libsass upstream: 3.0 --- See the release note of  Lib‐
705         Sass.
706
707         · Decent extends support
708
709         · Basic Sass Maps Support
710
711         · Better UTF-8 Support
712
713         · call() function
714
715         · Better Windows Support
716
717         · Spec Enhancements
718
719       · Added missing partial import support.  [#27 by item4]
720
721       · SOURCE_COMMENTS became deprecated.
722
723       · sass.compile()'s  parameter  source_comments  now  can take only bool
724         instead of str.  String values like 'none', 'line_numbers', and 'map'
725         become deprecated, and will be obsolete soon.
726
727       · build_directory() function has a new optional parameter output_style.
728
729       · build() method has a new optional parameter output_style.
730
731       · Added --output-style/-s option to build_sass command.  [#25]
732
733   Version 0.5.1
734       Released on September 23, 2014.
735
736       · Fixed  a  bug  that  SassMiddleware  yielded  str instead of bytes on
737         Python 3.
738
739       · Fixed several Unicode-related bugs on Windows.
740
741       · Fixed a bug that build_directory(),  SassMiddleware,  and  build_sass
742         don't recursively build subdirectories.
743
744   Version 0.5.0
745       Released on June 6, 2014.
746
747       · Follow  up the libsass upstream: 2.0 --- See the release note of Lib‐
748         Sass.
749
750         · Added indented syntax support (*.sass files).
751
752         · Added expanded selector support (BEM).
753
754         · Added string functions.
755
756         · Fixed UTF-8 support.
757
758         · Backward incompatibility: broken extends.
759
760   Unstable version 0.4.2.20140529.cd3ee1cbe3
761       Released on May 29, 2014.
762
763       · Version scheme changed to use periods (.) instead of hyphens (-)  due
764         to setuptools seems to treat hyphens special.
765
766       · Fixed malformed packaging that doesn't correctly preserve the package
767         name and version.
768
769   Unstable Version 0.4.2-20140528-cd3ee1cbe3
770       Released on May 28, 2014.
771
772       · Follow          up          the           libsass           upstream:
773         cd3ee1cbe34d5316eb762a43127a3de9575454ee.
774
775   Version 0.4.2
776       Released on May 22, 2014.
777
778       · Fixed build failing on Mac OS X 10.8 or earlier.  [#19]
779
780       · Fixed  UnicodeEncodeError that Manifest.build_one() method rises when
781         the input source contains any non-ASCII Unicode characters.
782
783   Version 0.4.1
784       Released on May 20, 2014.
785
786       · Fixed UnicodeEncodeError that rise when the input source contains any
787         non-ASCII Unicode characters.
788
789   Version 0.4.0
790       Released on May 6, 2014.
791
792       · sassc has a new -w/--watch option.
793
794       · Expose source maps support:
795
796         · sassc has a new -m/-g/--sourcemap option.
797
798         · SassMiddleware  now  also  creates  source map files with filenames
799           followed by .map suffix.
800
801         · Manifest.build_one() method has  a  new  source_map  option.   This
802           option  builds also a source map file with the filename followed by
803           .map suffix.
804
805         · sass.compile() has a new optional  parameter  source_comments.   It
806           can be one of sass.SOURCE_COMMENTS keys.  It also has a new parame‐
807           ter source_map_filename which is  required  only  when  source_com‐
808           ments='map'.
809
810       · Fixed Python 3 incompatibility of sassc program.
811
812       · Fixed a bug that multiple include_paths doesn't work on Windows.
813
814   Version 0.3.0
815       Released on February 21, 2014.
816
817       · Added support for Python 3.3.  [#7]
818
819       · Dropped support for Python 2.5.
820
821       · Fixed build failing on Mac OS X.  [#4, #5, #6 by Hyungoo Kang]
822
823       · Now  builder  creates  target  recursive  subdirectories  even  if it
824         doesn't exist yet, rather than siliently fails.  [#8, #9  by  Philipp
825         Volguine]
826
827       · Merged recent changes from libsass 1.0.1: 57a2f62--v1.0.1.
828
829         · Supports variable arguments.
830
831         · Supports sourcemaps.
832
833   Version 0.2.4
834       Released on December 4, 2012.
835
836       · Added sassc CLI executable script.
837
838       · Added sass.OUTPUT_STYLES constant map.
839
840       · Merged recent changes from libsass upstream: e997102--a84b181.
841
842   Version 0.2.3
843       Released on October 24, 2012.
844
845       · sassutils.distutils: Prevent double monkey patch of sdist.
846
847       · Merged upstream changes of libsass.
848
849   Version 0.2.2
850       Released on September 28, 2012.
851
852       · Fixed a link error on PyPy and Linux.
853
854       · Fixed build errors on Windows.
855
856   Version 0.2.1
857       Released on September 12, 2012.
858
859       · Support Windows.
860
861   Version 0.2.0
862       Released on August 24, 2012.
863
864       · Added new sassutils package.
865
866         · Added  sassutils.builder  module  to build the whole directory at a
867           time.
868
869         · Added sassutils.distutils module for distutils and setuptools inte‐
870           gration.
871
872         · Added  sassutils.wsgi  module  which provides a development-purpose
873           WSGI middleware.
874
875       · Added build_sass command for distutils/setuptools.
876
877   Version 0.1.1
878       Released on August 18, 2012.
879
880       · Fixed segmentation fault for reading filename which does  not  exist.
881         Now it raises a proper exceptions.IOError exception.
882
883   Version 0.1.0
884       Released on August 17, 2012.  Initial version.
885

REFERENCES

887   pysassc --- SassC compliant command line interface
888       This provides SassC compliant CLI executable named pysassc:
889
890          $ pysassc
891          Usage: pysassc [options] SCSS_FILE [CSS_FILE]
892
893       There are options as well:
894
895       -t <style>, --style <style>
896              Coding style of the compiled result.  The same as sass.compile()
897              function's output_style keyword argument.  Default is nested.
898
899       -s <style>, --output-style <style>
900              Alias for -t / --style.
901
902              Deprecated since version 0.11.0.
903
904
905       -I <dir>, --include-path <dir>
906              Optional directory path to find @imported (S)CSS files.  Can  be
907              multiply used.
908
909       -m, -g, --sourcemap
910              Emit source map.  Requires the second argument (output CSS file‐
911              name).  The filename of source map will be the output CSS  file‐
912              name followed by .map.
913
914              New in version 0.4.0.
915
916
917       -p, --precision
918              Set the precision for numbers. Default is 5.
919
920              New in version 0.7.0.
921
922
923       --source-comments
924              Include debug info in output.
925
926              New in version 0.11.0.
927
928
929       --sourcemap-file
930              Output file for source map
931
932              New in version 0.17.0.
933
934
935       --sourcemap-contents
936              Embed sourcesContent in source map.
937
938              New in version 0.17.0.
939
940
941       --sourcemap-embed
942              Embed sourceMappingUrl as data URI
943
944              New in version 0.17.0.
945
946
947       --omit-sourcemap-url
948              Omit source map URL comment from output
949
950              New in version 0.17.0.
951
952
953       --sourcemap-root
954              Base path, will be emitted to sourceRoot in source-map as is
955
956              New in version 0.17.0.
957
958
959       -v, --version
960              Prints the program version.
961
962       -h, --help
963              Prints the help message.
964
965   sass --- Binding of libsass
966       This  simple  C extension module provides a very simple binding of lib‐
967       sass, which is written in C/C++.  It contains only one function and one
968       exception type.
969
970       >>> import sass
971       >>> sass.compile(string='a { b { color: blue; } }')
972       'a b {
973         color: blue; }
974       '
975
976       exception sass.CompileError(msg)
977              The exception type that is raised by compile().  It is a subtype
978              of exceptions.ValueError.
979
980       sass.MODES = frozenset({'dirname', 'filename', 'string'})
981              (frozenset) The set of keywords compile() can take.
982
983       sass.OUTPUT_STYLES = {'compact': 2,  'compressed':  3,  'expanded':  1,
984       'nested': 0}
985              (collections.abc.Mapping) The dictionary of output styles.  Keys
986              are output name strings, and values are flag integers.
987
988       sass.SOURCE_COMMENTS = {'default':  1,  'line_numbers':  1,  'map':  2,
989       'none': 0}
990              (collections.abc.Mapping)  The  dictionary  of  source  comments
991              styles.  Keys are mode names, and values are corresponding  flag
992              integers.
993
994              New in version 0.4.0.
995
996
997              Deprecated since version 0.6.0.
998
999
1000       class sass.SassColor(r, g, b, a)
1001
1002       class sass.SassError(msg)
1003
1004       class sass.SassFunction(name, arguments, callable_)
1005              Custom   function  for  Sass.   It  can  be  instantiated  using
1006              from_lambda() and from_named_function() as well.
1007
1008              Parameters
1009
1010                     · name (str) -- the function name
1011
1012                     · arguments (collections.abc.Sequence)  --  the  argument
1013                       names
1014
1015                     · callable (collections.abc.Callable) -- the actual func‐
1016                       tion to be called
1017
1018              New in version 0.7.0.
1019
1020
1021              classmethod from_lambda(name, lambda_)
1022                     Make a SassFunction object from the given  lambda_  func‐
1023                     tion.   Since  lambda functions don't have their name, it
1024                     need its  name  as  well.   Arguments  are  automatically
1025                     inspected.
1026
1027                     Parameters
1028
1029                            · name (str) -- the function name
1030
1031                            · lambda  (types.LambdaType)  -- the actual lambda
1032                              function to be called
1033
1034                     Returns
1035                            a custom function wrapper of the lambda_ function
1036
1037                     Return type
1038                            SassFunction
1039
1040              classmethod from_named_function(function)
1041                     Make a  SassFunction  object  from  the  named  function.
1042                     Function name and arguments are automatically inspected.
1043
1044                     Parameters
1045                            function  (types.FunctionType)  -- the named func‐
1046                            tion to be called
1047
1048                     Returns
1049                            a custom function wrapper of the function
1050
1051                     Return type
1052                            SassFunction
1053
1054              property signature
1055                     Signature string of the function.
1056
1057       class sass.SassList(items, separator, bracketed=False)
1058
1059       class sass.SassMap(*args, **kwargs)
1060              Because sass maps can have mapping types as  keys,  we  need  an
1061              immutable hashable mapping type.
1062
1063              New in version 0.7.0.
1064
1065
1066       class sass.SassNumber(value, unit)
1067
1068       class sass.SassWarning(msg)
1069
1070       sass.and_join(strings)
1071              Join the given strings by commas with last ' and ' conjuction.
1072
1073              >>> and_join(['Korea', 'Japan', 'China', 'Taiwan'])
1074              'Korea, Japan, China, and Taiwan'
1075
1076              Parameters
1077                     strings -- a list of words to join
1078
1079              Returns
1080                     a joined string
1081
1082              Return type
1083                     str, basestring
1084
1085       sass.compile(**kwargs)
1086              There  are three modes of parameters compile() can take: string,
1087              filename, and dirname.
1088
1089              The string parameter is the most basic way to compile Sass.   It
1090              simply  takes a string of Sass code, and then returns a compiled
1091              CSS string.
1092
1093              Parameters
1094
1095                     · string (str) -- Sass  source  code  to  compile.   it's
1096                       exclusive to filename and dirname parameters
1097
1098                     · output_style  (str)  -- an optional coding style of the
1099                       compiled result.  choose one  of:  'nested'  (default),
1100                       'expanded', 'compact', 'compressed'
1101
1102                     · source_comments (bool) -- whether to add comments about
1103                       source lines.  False by default
1104
1105                     · source_map_contents (bool) -- embed include contents in
1106                       map
1107
1108                     · source_map_embed  (bool)  --  embed sourceMappingUrl as
1109                       data URI
1110
1111                     · omit_source_map_url (bool) -- omit source map URL  com‐
1112                       ment from output
1113
1114                     · source_map_root  (str) -- base path, will be emitted in
1115                       source map as is
1116
1117                     · include_paths (collections.abc.Sequence) -- an optional
1118                       list of paths to find @imported Sass/CSS source files
1119
1120                     · precision (int) -- optional precision for numbers. 5 by
1121                       default.
1122
1123                     · custom_functions (set,  collections.abc.Sequence,  col‐
1124                       lections.abc.Mapping)  --  optional  mapping  of custom
1125                       functions.  see also below custom functions description
1126
1127                     · custom_import_extensions -- (ignored, for backward com‐
1128                       patibility)
1129
1130                     · indented (bool) -- optional declaration that the string
1131                       is Sass, not SCSS formatted. False by default
1132
1133                     · importers (collections.abc.Callable) -- optional  call‐
1134                       back  functions.   see  also  below  importer callbacks
1135                       description
1136
1137              Returns
1138                     the compiled CSS string
1139
1140              Return type
1141                     str
1142
1143              Raises sass.CompileError -- when it fails for  any  reason  (for
1144                     example the given Sass has broken syntax)
1145
1146              The  filename  is the most commonly used way.  It takes a string
1147              of Sass filename, and then returns a compiled CSS string.
1148
1149              Parameters
1150
1151                     · filename (str) -- the filename of Sass source  code  to
1152                       compile.   it's exclusive to string and dirname parame‐
1153                       ters
1154
1155                     · output_style (str) -- an optional coding style  of  the
1156                       compiled  result.   choose  one of: 'nested' (default),
1157                       'expanded', 'compact', 'compressed'
1158
1159                     · source_comments (bool) -- whether to add comments about
1160                       source lines.  False by default
1161
1162                     · source_map_filename  (str) -- use source maps and indi‐
1163                       cate the source map output filename.   None  means  not
1164                       using source maps.  None by default.
1165
1166                     · source_map_contents (bool) -- embed include contents in
1167                       map
1168
1169                     · source_map_embed (bool) --  embed  sourceMappingUrl  as
1170                       data URI
1171
1172                     · omit_source_map_url  (bool) -- omit source map URL com‐
1173                       ment from output
1174
1175                     · source_map_root (str) -- base path, will be emitted  in
1176                       source map as is
1177
1178                     · include_paths (collections.abc.Sequence) -- an optional
1179                       list of paths to find @imported Sass/CSS source files
1180
1181                     · precision (int) -- optional precision for numbers. 5 by
1182                       default.
1183
1184                     · custom_functions  (set,  collections.abc.Sequence, col‐
1185                       lections.abc.Mapping) --  optional  mapping  of  custom
1186                       functions.  see also below custom functions description
1187
1188                     · custom_import_extensions -- (ignored, for backward com‐
1189                       patibility)
1190
1191                     · importers (collections.abc.Callable) -- optional  call‐
1192                       back  functions.   see  also  below  importer callbacks
1193                       description
1194
1195              Returns
1196                     the compiled CSS string, or a pair of  the  compiled  CSS
1197                     string  and  the source map string if source_map_filename
1198                     is set
1199
1200              Return type
1201                     str, tuple
1202
1203              Raises
1204
1205                     · sass.CompileError -- when it fails for any reason  (for
1206                       example the given Sass has broken syntax)
1207
1208                     · exceptions.IOError  --  when the filename doesn't exist
1209                       or cannot be read
1210
1211              The dirname is useful for automation.  It takes a pair of paths.
1212              The  first of the dirname pair refers the source directory, con‐
1213              tains several Sass source files to compiled.  Sass source  files
1214              can be nested in directories.  The second of the pair refers the
1215              output directory that compiled CSS files would be saved.  Direc‐
1216              tory  tree  structure of the source directory will be maintained
1217              in the output directory as well.  If dirname parameter  is  used
1218              the function returns None.
1219
1220              Parameters
1221
1222                     · dirname  (tuple) -- a pair of (source_dir, output_dir).
1223                       it's exclusive to string and filename parameters
1224
1225                     · output_style (str) -- an optional coding style  of  the
1226                       compiled  result.   choose  one of: 'nested' (default),
1227                       'expanded', 'compact', 'compressed'
1228
1229                     · source_comments (bool) -- whether to add comments about
1230                       source lines.  False by default
1231
1232                     · source_map_contents (bool) -- embed include contents in
1233                       map
1234
1235                     · source_map_embed (bool) --  embed  sourceMappingUrl  as
1236                       data URI
1237
1238                     · omit_source_map_url  (bool) -- omit source map URL com‐
1239                       ment from output
1240
1241                     · source_map_root (str) -- base path, will be emitted  in
1242                       source map as is
1243
1244                     · include_paths (collections.abc.Sequence) -- an optional
1245                       list of paths to find @imported Sass/CSS source files
1246
1247                     · precision (int) -- optional precision for numbers. 5 by
1248                       default.
1249
1250                     · custom_functions  (set,  collections.abc.Sequence, col‐
1251                       lections.abc.Mapping) --  optional  mapping  of  custom
1252                       functions.  see also below custom functions description
1253
1254                     · custom_import_extensions -- (ignored, for backward com‐
1255                       patibility)
1256
1257              Raises sass.CompileError -- when it fails for  any  reason  (for
1258                     example the given Sass has broken syntax)
1259
1260              The custom_functions parameter can take three types of forms:
1261
1262              set/Sequence of SassFunctions
1263                 It is the most general form.  Although pretty verbose, it can
1264                 take any kind of callables like type objects,  unnamed  func‐
1265                 tions, and user-defined callables.
1266
1267                     sass.compile(
1268                         ...,
1269                         custom_functions={
1270                             sass.SassFunction('func-name', ('$a', '$b'), some_callable),
1271                             ...
1272                         }
1273                     )
1274
1275              Mapping of names to functions
1276                     Less  general, but easier-to-use form.  Although it's not
1277                     it can take any kind of callables, it can take  any  kind
1278                     of  functions defined using def/lambda syntax.  It cannot
1279                     take callables other than them since inspecting arguments
1280                     is not always available for every kind of callables.
1281
1282                        sass.compile(
1283                            ...,
1284                            custom_functions={
1285                                'func-name': lambda a, b: ...,
1286                                ...
1287                            }
1288                        )
1289
1290              set/Sequence of named functions
1291                 Not general, but the easiest-to-use form for named functions.
1292                 It can take only named functions, defined using def.  It can‐
1293                 not take lambdas sinc names are unavailable for them.
1294
1295                     def func_name(a, b):
1296                         return ...
1297
1298                     sass.compile(
1299                         ...,
1300                         custom_functions={func_name}
1301                     )
1302
1303              Newer  versions  of libsass allow developers to define callbacks
1304              to be called and given a chance to process  @import  directives.
1305              You  can  define yours by passing in a list of callables via the
1306              importers parameter. The callables must be passed as 2-tuples in
1307              the form:
1308
1309                 (priority_int, callback_fn)
1310
1311              A  priority of zero is acceptable; priority determines the order
1312              callbacks are attempted.
1313
1314              These callbacks can accept one  or  two  string  arguments.  The
1315              first argument is the path that was passed to the @import direc‐
1316              tive; the second (optional) argument is  the  previous  resolved
1317              path,  where the @import directive was found. The callbacks must
1318              either return None to indicate the path wasn't handled  by  that
1319              callback  (to continue with others or fall back on internal lib‐
1320              sass filesystem behaviour) or a list of one or more tuples, each
1321              in one of three forms:
1322
1323              · A 1-tuple representing an alternate path to handle internally;
1324                or,
1325
1326              · A 2-tuple representing an alternate path and the content  that
1327                path represents; or,
1328
1329              · A  3-tuple representing the same as the 2-tuple with the addi‐
1330                tion of a "sourcemap".
1331
1332              All tuple return values must be strings. As a not overly realis‐
1333              tic example:
1334
1335                 def my_importer(path, prev):
1336                     return [(path, '#' + path + ' { color: red; }')]
1337
1338                 sass.compile(
1339                         ...,
1340                         importers=[(0, my_importer)]
1341                     )
1342
1343              Now,  within  the  style source, attempting to @import 'button';
1344              will instead attach color: red as a property of an element  with
1345              the imported name.
1346
1347              New in version 0.4.0: Added source_comments and source_map_file‐
1348              name parameters.
1349
1350
1351              Changed in version 0.6.0: The source_comments parameter  becomes
1352              to take only bool instead of str.
1353
1354
1355              Deprecated  since  version 0.6.0: Values like 'none', 'line_num‐
1356              bers', and 'map' for the source_comments  parameter  are  depre‐
1357              cated.
1358
1359
1360              New in version 0.7.0: Added precision parameter.
1361
1362
1363              New in version 0.7.0: Added custom_functions parameter.
1364
1365
1366              New  in  version  0.11.0:  source_map_filename no longer implies
1367              source_comments.
1368
1369
1370              New    in    version    0.17.0:    Added    source_map_contents,
1371              source_map_embed,   omit_source_map_url,   and   source_map_root
1372              parameters.
1373
1374
1375              New in version 0.18.0: The importer callbacks  can  now  take  a
1376              second   argument,   the  previously-  resolved  path,  so  that
1377              importers can do relative path resolution.
1378
1379
1380   sassutils --- Additional utilities related to Sass
1381       This package provides several  additional  utilities  related  to  Sass
1382       which depends on libsass core (sass module).
1383
1384   sassutils.builder --- Build the whole directory
1385       class        sassutils.builder.Manifest(sass_path,       css_path=None,
1386       wsgi_path=None, strip_extension=None)
1387              Building manifest of Sass/SCSS.
1388
1389              Parameters
1390
1391                     · sass_path (str, basestring) -- the path of  the  direc‐
1392                       tory that contains Sass/SCSS source files
1393
1394                     · css_path (str, basestring) -- the path of the directory
1395                       to store compiled CSS files
1396
1397                     · strip_extension (bool) -- whether to remove the  origi‐
1398                       nal file extension
1399
1400              build(package_dir, output_style='nested')
1401                     Builds  the  Sass/SCSS  files in the specified sass_path.
1402                     It finds sass_path and locates css_path  as  relative  to
1403                     the given package_dir.
1404
1405                     Parameters
1406
1407                            · package_dir  (str,  basestring)  --  the path of
1408                              package directory
1409
1410                            · output_style (str) -- an optional  coding  style
1411                              of the compiled result.  choose one of: 'nested'
1412                              (default), 'expanded', 'compact', 'compressed'
1413
1414                     Returns
1415                            the set of compiled CSS filenames
1416
1417                     Return type
1418                            frozenset
1419
1420                     New in version 0.6.0: The output_style parameter.
1421
1422
1423              build_one(package_dir, filename, source_map=False)
1424                     Builds one Sass/SCSS file.
1425
1426                     Parameters
1427
1428                            · package_dir (str, basestring)  --  the  path  of
1429                              package directory
1430
1431                            · filename  (str,  basestring)  -- the filename of
1432                              Sass/SCSS source to compile
1433
1434                            · source_map (bool) -- whether to use source maps.
1435                              if True it also write a source map to a filename
1436                              followed by .map suffix.  default is False
1437
1438                     Returns
1439                            the filename of compiled CSS
1440
1441                     Return type
1442                            str, basestring
1443
1444                     New in version 0.4.0: Added optional  source_map  parame‐
1445                     ter.
1446
1447
1448              resolve_filename(package_dir, filename)
1449                     Gets  a  proper full relative path of Sass source and CSS
1450                     source that will be generated, according  to  package_dir
1451                     and filename.
1452
1453                     Parameters
1454
1455                            · package_dir  (str,  basestring)  --  the path of
1456                              package directory
1457
1458                            · filename (str, basestring) --  the  filename  of
1459                              Sass/SCSS source to compile
1460
1461                     Returns
1462                            a pair of (sass, css) path
1463
1464                     Return type
1465                            tuple
1466
1467              unresolve_filename(package_dir, filename)
1468                     Retrieves  the probable source path from the output file‐
1469                     name.  Pass in a .css path to get out a .scss path.
1470
1471                     Parameters
1472
1473                            · package_dir (str) -- the  path  of  the  package
1474                              directory
1475
1476                            · filename (str) -- the css filename
1477
1478                     Returns
1479                            the scss filename
1480
1481                     Return type
1482                            str
1483
1484       sassutils.builder.SUFFIXES = frozenset({'sass', 'scss'})
1485              (frozenset) The set of supported filename suffixes.
1486
1487       sassutils.builder.SUFFIX_PATTERN = re.compile('[.](scss|sass)$')
1488              (re.RegexObject) The regular expression pattern which matches to
1489              filenames of supported SUFFIXES.
1490
1491       sassutils.builder.build_directory(sass_path,       css_path,       out‐
1492       put_style='nested',   _root_sass=None,   _root_css=None,   strip_exten‐
1493       sion=False)
1494              Compiles all Sass/SCSS files in path to CSS.
1495
1496              Parameters
1497
1498                     · sass_path (str, basestring) -- the path of  the  direc‐
1499                       tory which contains source files to compile
1500
1501                     · css_path (str, basestring) -- the path of the directory
1502                       compiled CSS files will go
1503
1504                     · output_style (str) -- an optional coding style  of  the
1505                       compiled  result.   choose  one of: 'nested' (default),
1506                       'expanded', 'compact', 'compressed'
1507
1508              Returns
1509                     a dictionary of source filenames to  compiled  CSS  file‐
1510                     names
1511
1512              Return type
1513                     collections.abc.Mapping
1514
1515              New in version 0.6.0: The output_style parameter.
1516
1517
1518   sassutils.distutils --- setuptools/distutils integration
1519       This  module  provides  extensions  (and  some  magical monkey-patches,
1520       sorry) of the standard distutils and setuptools (now  it's  named  Dis‐
1521       tribute) for libsass.
1522
1523       To  use  this,  add  libsass into setup_requires (not install_requires)
1524       option of the setup.py script:
1525
1526          from setuptools import setup
1527
1528          setup(
1529              # ...,
1530              setup_requires=['libsass >= 0.6.0']
1531          )
1532
1533       It will adds build_sass command to the setup.py script:
1534
1535          $ python setup.py build_sass
1536
1537       This commands builds Sass/SCSS files  to  compiled  CSS  files  of  the
1538       project and makes the package archive (made by sdist, bdist, and so on)
1539       to include these compiled CSS files.
1540
1541       To set the directory of Sass/SCSS source files  and  the  directory  to
1542       store compiled CSS files, specify sass_manifests option:
1543
1544          from setuptools import find_packages, setup
1545
1546          setup(
1547              name='YourPackage',
1548              packages=find_packages(),
1549              sass_manifests={
1550                  'your.webapp': ('static/sass', 'static/css')
1551              },
1552              setup_requires=['libsass >= 0.6.0']
1553          )
1554
1555       The  option  should  be  a  mapping of package names to pairs of paths,
1556       e.g.:
1557
1558          {
1559              'package': ('static/sass', 'static/css'),
1560              'package.name': ('static/scss', 'static')
1561          }
1562
1563       The option can also be a mapping of package names to  manifest  dictio‐
1564       naries:
1565
1566          {
1567              'package': {
1568                  'sass_path': 'static/sass',
1569                  'css_path': 'static/css',
1570                  'strip_extension': True,
1571              },
1572          }
1573
1574       New  in  version 0.15.0: Added strip_extension so a.scss is compiled to
1575       a.css instead of a.scss.css.  This option will default to True  in  the
1576       future.
1577
1578
1579       New in version 0.6.0: Added --output-style/-s option to build_sass com‐
1580       mand.
1581
1582
1583       class sassutils.distutils.build_sass(dist, **kw)
1584              Builds Sass/SCSS files to CSS files.
1585
1586              finalize_options()
1587                     Set final values for all the options  that  this  command
1588                     supports.  This is always called as late as possible, ie.
1589                     after any option assignments  from  the  command-line  or
1590                     from  other  commands  have been done.  Thus, this is the
1591                     place to code option dependencies: if  'foo'  depends  on
1592                     'bar', then it is safe to set 'foo' from 'bar' as long as
1593                     'foo' still has the same value it was assigned  in  'ini‐
1594                     tialize_options()'.
1595
1596                     This method must be implemented by all command classes.
1597
1598              get_package_dir(package)
1599                     Returns  the directory, relative to the top of the source
1600                     distribution, where package package should be  found  (at
1601                     least according to the package_dir option, if any).
1602
1603                     Copied  from distutils.command.build_py.get_package_dir()
1604                     method.
1605
1606              initialize_options()
1607                     Set default values for all the options that this  command
1608                     supports.   Note that these defaults may be overridden by
1609                     other commands, by the setup script, by config files,  or
1610                     by the command-line.  Thus, this is not the place to code
1611                     dependencies  between   options;   generally,   'initial‐
1612                     ize_options()'   implementations  are  just  a  bunch  of
1613                     "self.foo = None" assignments.
1614
1615                     This method must be implemented by all command classes.
1616
1617              run()  A command's raison d'etre: carry out the action it exists
1618                     to  perform,  controlled  by  the  options initialized in
1619                     'initialize_options()', customized by other commands, the
1620                     setup  script,  the  command-line,  and config files, and
1621                     finalized in 'finalize_options()'.  All  terminal  output
1622                     and filesystem interaction should be done by 'run()'.
1623
1624                     This method must be implemented by all command classes.
1625
1626       sassutils.distutils.validate_manifests(dist, attr, value)
1627              Verifies  that value is an expected mapping of package to sassu‐
1628              tils.builder.Manifest.
1629
1630   sassutils.wsgi --- WSGI middleware for development purpose
1631       class  sassutils.wsgi.SassMiddleware(app,  manifests,   package_dir={},
1632       error_status='200 OK')
1633              WSGI  middleware  for development purpose.  Everytime a CSS file
1634              has requested it finds a matched Sass/SCSS source file and  then
1635              compiled it into CSS.
1636
1637              It shows syntax errors in three ways:
1638
1639              Heading comment
1640                     The  result  CSS  includes  detailed error message in the
1641                     heading CSS comment e.g.:
1642
1643                        /*
1644                        Error: invalid property name
1645                        */
1646
1647              Red text in body:before
1648                     The result CSS draws detailed error  message  in  :before
1649                     pseudo-class of body element e.g.:
1650
1651                        body:before {
1652                            content: 'Error: invalid property name';
1653                            color: maroon;
1654                            background-color: white;
1655                        }
1656
1657                     In  most  cases  you  could  be  aware of syntax error by
1658                     refreshing your working document because it will  removes
1659                     all other styles and leaves only a red text.
1660
1661              logging
1662                     It logs syntax errors if exist during compilation to sas‐
1663                     sutils.wsgi.SassMiddleware logger with level ERROR.
1664
1665                     To enable this:
1666
1667                        from logging import Formatter, StreamHandler, getLogger
1668                        logger = getLogger('sassutils.wsgi.SassMiddleware')
1669                        handler = StreamHandler(level=logging.ERROR)
1670                        formatter = Formatter(fmt='*' * 80 + '\n%(message)s\n' + '*' * 80)
1671                        handler.setFormatter(formatter)
1672                        logger.addHandler(handler)
1673
1674                     Or simply:
1675
1676                        import logging
1677                        logging.basicConfig()
1678
1679              Parameters
1680
1681                     · app (collections.abc.Callable) -- the WSGI  application
1682                       to wrap
1683
1684                     · manifests  (collections.abc.Mapping) -- build settings.
1685                       the same format  to  setup.py  script's  sass_manifests
1686                       option
1687
1688                     · package_dir  (collections.abc.Mapping) -- optional map‐
1689                       ping of package names to directories.  the same  format
1690                       to setup.py script's package_dir option
1691
1692              Changed  in version 0.4.0: It creates also source map files with
1693              filenames followed by .map suffix.
1694
1695
1696              New in version 0.8.0: It logs syntax errors if exist during com‐
1697              pilation  to  sassutils.wsgi.SassMiddleware  logger  with  level
1698              ERROR.
1699
1700
1701              static quote_css_string(s)
1702                     Quotes a string as CSS string literal.
1703

CREDIT

1705       Hong Minhee wrote this Python binding of LibSass.
1706
1707       Hampton Catlin and Aaron Leung wrote LibSass, which is  portable  C/C++
1708       implementation of Sass.
1709
1710       Hampton  Catlin  originally  designed Sass language and wrote the first
1711       reference implementation of it in Ruby.
1712
1713       The above three softwares are all distributed under MIT license.
1714

OPEN SOURCE

1716       GitHub (Git repository + issues)
1717              https://github.com/sass/libsass-python
1718
1719       Azure Pipelines CI (linux + windows)
1720              https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
1721              Build   Status.TP   Azure  Pipelines  Coverage  (Test  coverage)
1722              https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
1723              Coverage  Status.TP  PyPI https://pypi.org/pypi/libsass/ PyPI.TP
1724              Changelog changes
1725

INDICES AND TABLES

1727       · genindex
1728
1729       · modindex
1730
1731       · search
1732

AUTHOR

1734       Hong Minhee
1735
1737       2020, Hong Minhee
1738
1739
1740
1741
17420.20.0                           Jul 29, 2020                       PYSASSC(1)
Impressum