@@ -225,7 +225,8 @@ def _raise(e):
225225
226226def compile_dirname (
227227 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 ,
229230):
230231 fs_encoding = sys .getfilesystemencoding () or sys .getdefaultencoding ()
231232 for dirpath , _ , filenames in os .walk (search_path , onerror = _raise ):
@@ -243,6 +244,8 @@ def compile_dirname(
243244 s , v , _ = _sass .compile_filename (
244245 input_filename , output_style , source_comments , include_paths ,
245246 precision , None , custom_functions , importers , None ,
247+ source_map_contents , source_map_embed , omit_source_map_url ,
248+ source_map_root ,
246249 )
247250 if s :
248251 v = v .decode ('UTF-8' )
@@ -284,6 +287,14 @@ def compile(**kwargs):
284287 :param source_comments: whether to add comments about source lines.
285288 :const:`False` by default
286289 :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`
287298 :param include_paths: an optional list of paths to find ``@import``\ ed
288299 Sass/CSS source files
289300 :type include_paths: :class:`collections.abc.Sequence`
@@ -325,6 +336,14 @@ def compile(**kwargs):
325336 output filename. :const:`None` means not
326337 using source maps. :const:`None` by default.
327338 :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`
328347 :param include_paths: an optional list of paths to find ``@import``\ ed
329348 Sass/CSS source files
330349 :type include_paths: :class:`collections.abc.Sequence`
@@ -368,6 +387,14 @@ def compile(**kwargs):
368387 :param source_comments: whether to add comments about source lines.
369388 :const:`False` by default
370389 :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`
371398 :param include_paths: an optional list of paths to find ``@import``\ ed
372399 Sass/CSS source files
373400 :type include_paths: :class:`collections.abc.Sequence`
@@ -499,6 +526,10 @@ def my_importer(path):
499526 .. versionadded:: 0.11.0
500527 ``source_map_filename`` no longer implies ``source_comments``.
501528
529+ .. versionadded:: 0.17.0
530+ Added ``source_map_contents``, ``source_map_embed``,
531+ ``omit_source_map_url``, and ``source_map_root`` parameters.
532+
502533 """
503534 modes = set ()
504535 for mode_name in MODES :
@@ -568,6 +599,14 @@ def _get_file_arg(key):
568599 source_map_filename = _get_file_arg ('source_map_filename' )
569600 output_filename_hint = _get_file_arg ('output_filename_hint' )
570601
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+
571610 # #208: cwd is always included in include paths
572611 include_paths = (os .getcwd (),)
573612 include_paths += tuple (kwargs .pop ('include_paths' , ()) or ())
@@ -620,6 +659,8 @@ def _get_file_arg(key):
620659 s , v = _sass .compile_string (
621660 string , output_style , source_comments , include_paths , precision ,
622661 custom_functions , indented , importers ,
662+ source_map_contents , source_map_embed , omit_source_map_url ,
663+ source_map_root ,
623664 )
624665 if s :
625666 return v .decode ('utf-8' )
@@ -636,6 +677,8 @@ def _get_file_arg(key):
636677 filename , output_style , source_comments , include_paths , precision ,
637678 source_map_filename , custom_functions , importers ,
638679 output_filename_hint ,
680+ source_map_contents , source_map_embed , omit_source_map_url ,
681+ source_map_root ,
639682 )
640683 if s :
641684 v = v .decode ('utf-8' )
@@ -655,6 +698,8 @@ def _get_file_arg(key):
655698 s , v = compile_dirname (
656699 search_path , output_path , output_style , source_comments ,
657700 include_paths , precision , custom_functions , importers ,
701+ source_map_contents , source_map_embed , omit_source_map_url ,
702+ source_map_root ,
658703 )
659704 if s :
660705 return
0 commit comments