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

REFERENCES

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

CREDIT

1696       Hong Minhee wrote this Python binding of LibSass.
1697
1698       Hampton Catlin and Aaron Leung wrote LibSass, which is  portable  C/C++
1699       implementation of Sass.
1700
1701       Hampton  Catlin  originally  designed Sass language and wrote the first
1702       reference implementation of it in Ruby.
1703
1704       The above three softwares are all distributed under MIT license.
1705

OPEN SOURCE

1707       GitHub (Git repository + issues)
1708              https://github.com/sass/libsass-python
1709
1710       Azure Pipelines CI (linux + windows)
1711              https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
1712              Build   Status.TP   Azure  Pipelines  Coverage  (Test  coverage)
1713              https://dev.azure.com/asottile/asottile/_build/latest?definitionId=22&branchName=master
1714              Coverage  Status.TP  PyPI https://pypi.org/pypi/libsass/ PyPI.TP
1715              Changelog changes
1716

INDICES AND TABLES

1718       · genindex
1719
1720       · modindex
1721
1722       · search
1723

AUTHOR

1725       Hong Minhee
1726
1728       2020, Hong Minhee
1729
1730
1731
1732
17330.19.4                           Jan 30, 2020                       PYSASSC(1)
Impressum