@@ -225,7 +225,8 @@ def _raise(e):
225
225
226
226
def compile_dirname (
227
227
search_path , output_path , output_style , source_comments , include_paths ,
228
- precision , custom_functions , importers ,
228
+ precision , custom_functions , importers , source_map_contents ,
229
+ source_map_embed , omit_source_map_url , source_map_root ,
229
230
):
230
231
fs_encoding = sys .getfilesystemencoding () or sys .getdefaultencoding ()
231
232
for dirpath , _ , filenames in os .walk (search_path , onerror = _raise ):
@@ -243,6 +244,8 @@ def compile_dirname(
243
244
s , v , _ = _sass .compile_filename (
244
245
input_filename , output_style , source_comments , include_paths ,
245
246
precision , None , custom_functions , importers , None ,
247
+ source_map_contents , source_map_embed , omit_source_map_url ,
248
+ source_map_root ,
246
249
)
247
250
if s :
248
251
v = v .decode ('UTF-8' )
@@ -284,6 +287,14 @@ def compile(**kwargs):
284
287
:param source_comments: whether to add comments about source lines.
285
288
:const:`False` by default
286
289
:type source_comments: :class:`bool`
290
+ :param source_map_contents: embed include contents in map
291
+ :type source_map_contents: :class:`bool`
292
+ :param source_map_embed: embed sourceMappingUrl as data URI
293
+ :type source_map_embed: :class:`bool`
294
+ :param omit_source_map_url: omit source map URL comment from output
295
+ :type omit_source_map_url: :class:`bool`
296
+ :param source_map_root: base path, will be emitted in source map as is
297
+ :type source_map_root: :class:`str`
287
298
:param include_paths: an optional list of paths to find ``@import``\ ed
288
299
Sass/CSS source files
289
300
:type include_paths: :class:`collections.abc.Sequence`
@@ -325,6 +336,14 @@ def compile(**kwargs):
325
336
output filename. :const:`None` means not
326
337
using source maps. :const:`None` by default.
327
338
:type source_map_filename: :class:`str`
339
+ :param source_map_contents: embed include contents in map
340
+ :type source_map_contents: :class:`bool`
341
+ :param source_map_embed: embed sourceMappingUrl as data URI
342
+ :type source_map_embed: :class:`bool`
343
+ :param omit_source_map_url: omit source map URL comment from output
344
+ :type omit_source_map_url: :class:`bool`
345
+ :param source_map_root: base path, will be emitted in source map as is
346
+ :type source_map_root: :class:`str`
328
347
:param include_paths: an optional list of paths to find ``@import``\ ed
329
348
Sass/CSS source files
330
349
:type include_paths: :class:`collections.abc.Sequence`
@@ -368,6 +387,14 @@ def compile(**kwargs):
368
387
:param source_comments: whether to add comments about source lines.
369
388
:const:`False` by default
370
389
:type source_comments: :class:`bool`
390
+ :param source_map_contents: embed include contents in map
391
+ :type source_map_contents: :class:`bool`
392
+ :param source_map_embed: embed sourceMappingUrl as data URI
393
+ :type source_map_embed: :class:`bool`
394
+ :param omit_source_map_url: omit source map URL comment from output
395
+ :type omit_source_map_url: :class:`bool`
396
+ :param source_map_root: base path, will be emitted in source map as is
397
+ :type source_map_root: :class:`str`
371
398
:param include_paths: an optional list of paths to find ``@import``\ ed
372
399
Sass/CSS source files
373
400
:type include_paths: :class:`collections.abc.Sequence`
@@ -499,6 +526,10 @@ def my_importer(path):
499
526
.. versionadded:: 0.11.0
500
527
``source_map_filename`` no longer implies ``source_comments``.
501
528
529
+ .. versionadded:: 0.17.0
530
+ Added ``source_map_contents``, ``source_map_embed``,
531
+ ``omit_source_map_url``, and ``source_map_root`` parameters.
532
+
502
533
"""
503
534
modes = set ()
504
535
for mode_name in MODES :
@@ -568,6 +599,14 @@ def _get_file_arg(key):
568
599
source_map_filename = _get_file_arg ('source_map_filename' )
569
600
output_filename_hint = _get_file_arg ('output_filename_hint' )
570
601
602
+ source_map_contents = kwargs .pop ('source_map_contents' , False )
603
+ source_map_embed = kwargs .pop ('source_map_embed' , False )
604
+ omit_source_map_url = kwargs .pop ('omit_source_map_url' , False )
605
+ source_map_root = kwargs .pop ('source_map_root' , None )
606
+
607
+ if isinstance (source_map_root , text_type ):
608
+ source_map_root = source_map_root .encode ('utf-8' )
609
+
571
610
# #208: cwd is always included in include paths
572
611
include_paths = (os .getcwd (),)
573
612
include_paths += tuple (kwargs .pop ('include_paths' , ()) or ())
@@ -620,6 +659,8 @@ def _get_file_arg(key):
620
659
s , v = _sass .compile_string (
621
660
string , output_style , source_comments , include_paths , precision ,
622
661
custom_functions , indented , importers ,
662
+ source_map_contents , source_map_embed , omit_source_map_url ,
663
+ source_map_root ,
623
664
)
624
665
if s :
625
666
return v .decode ('utf-8' )
@@ -636,6 +677,8 @@ def _get_file_arg(key):
636
677
filename , output_style , source_comments , include_paths , precision ,
637
678
source_map_filename , custom_functions , importers ,
638
679
output_filename_hint ,
680
+ source_map_contents , source_map_embed , omit_source_map_url ,
681
+ source_map_root ,
639
682
)
640
683
if s :
641
684
v = v .decode ('utf-8' )
@@ -655,6 +698,8 @@ def _get_file_arg(key):
655
698
s , v = compile_dirname (
656
699
search_path , output_path , output_style , source_comments ,
657
700
include_paths , precision , custom_functions , importers ,
701
+ source_map_contents , source_map_embed , omit_source_map_url ,
702
+ source_map_root ,
658
703
)
659
704
if s :
660
705
return
0 commit comments