@@ -505,6 +505,17 @@ static void _add_custom_importers(
505505 sass_option_set_c_importers (options, importer_list);
506506}
507507
508+ static void _add_custom_import_extensions (
509+ struct Sass_Options * options, PyObject* custom_import_extensions
510+ ) {
511+ Py_ssize_t i;
512+
513+ for (i = 0 ; i < PyList_GET_SIZE (custom_import_extensions); i += 1 ) {
514+ PyObject* ext = PyList_GET_ITEM (custom_import_extensions, i);
515+ sass_option_push_import_extension (options, PyBytes_AS_STRING (ext));
516+ }
517+ }
518+
508519static PyObject *
509520PySass_compile_string (PyObject *self, PyObject *args) {
510521 struct Sass_Context *ctx;
@@ -516,13 +527,15 @@ PySass_compile_string(PyObject *self, PyObject *args) {
516527 int source_comments, error_status, precision, indented;
517528 PyObject *custom_functions;
518529 PyObject *custom_importers;
530+ PyObject *custom_import_extensions;
519531 PyObject *result;
520532
521533 if (!PyArg_ParseTuple (args,
522- PySass_IF_PY3 (" yiiyiOiO " , " siisiOiO " ),
534+ PySass_IF_PY3 (" yiiyiOiOO " , " siisiOiOO " ),
523535 &string, &output_style, &source_comments,
524536 &include_paths, &precision,
525- &custom_functions, &indented, &custom_importers)) {
537+ &custom_functions, &indented, &custom_importers,
538+ &custom_import_extensions)) {
526539 return NULL ;
527540 }
528541
@@ -535,6 +548,7 @@ PySass_compile_string(PyObject *self, PyObject *args) {
535548 sass_option_set_is_indented_syntax_src (options, indented);
536549 _add_custom_functions (options, custom_functions);
537550 _add_custom_importers (options, custom_importers);
551+ _add_custom_import_extensions (options, custom_import_extensions);
538552 sass_compile_data_context (context);
539553
540554 ctx = sass_data_context_get_context (context);
@@ -560,14 +574,15 @@ PySass_compile_filename(PyObject *self, PyObject *args) {
560574 Sass_Output_Style output_style;
561575 int source_comments, error_status, precision;
562576 PyObject *source_map_filename, *custom_functions, *custom_importers,
563- *result, *output_filename_hint;
577+ *result, *output_filename_hint, *custom_import_extensions ;
564578
565579 if (!PyArg_ParseTuple (args,
566- PySass_IF_PY3 (" yiiyiOOOO " , " siisiOOOO " ),
580+ PySass_IF_PY3 (" yiiyiOOOOO " , " siisiOOOOO " ),
567581 &filename, &output_style, &source_comments,
568582 &include_paths, &precision,
569583 &source_map_filename, &custom_functions,
570- &custom_importers, &output_filename_hint)) {
584+ &custom_importers, &output_filename_hint,
585+ &custom_import_extensions)) {
571586 return NULL ;
572587 }
573588
@@ -594,6 +609,7 @@ PySass_compile_filename(PyObject *self, PyObject *args) {
594609 sass_option_set_precision (options, precision);
595610 _add_custom_functions (options, custom_functions);
596611 _add_custom_importers (options, custom_importers);
612+ _add_custom_import_extensions (options, custom_import_extensions);
597613 sass_compile_file_context (context);
598614
599615 ctx = sass_file_context_get_context (context);
0 commit comments