Skip to content

Commit 0e2fa4f

Browse files
committed
Add ENABLE_LOAD_PLUGINS
1 parent 2450903 commit 0e2fa4f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/plugins.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ namespace Sass {
5959
// load one specific plugin
6060
bool Plugins::load_plugin (const std::string& path)
6161
{
62-
62+
#ifdef ENABLE_LOAD_PLUGINS
6363
typedef const char* (*__plugin_version__)(void);
6464
typedef Sass_Function_List (*__plugin_load_fns__)(void);
6565
typedef Sass_Importer_List (*__plugin_load_imps__)(void);
6666

67-
#ifndef _WASM
6867
if (LOAD_LIB(plugin, path))
6968
{
7069
// try to load initial function to query libsass version suppor
@@ -111,7 +110,7 @@ namespace Sass {
111110
if (const char* dlopen_error = dlerror()) std::cerr << dlopen_error << std::endl;
112111
}
113112
#else
114-
std::cerr << "loading plugin unsupported <" << path << ">" << std::endl;
113+
std::cerr << "plugins loading is unsupported <" << path << ">" << std::endl;
115114
#endif
116115

117116
return false;

src/plugins.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "utf8_string.hpp"
77
#include "sass/functions.h"
88

9+
#ifdef ENABLE_LOAD_PLUGINS
910
#ifdef _WIN32
1011

1112
#define LOAD_LIB(var, path) HMODULE var = LoadLibraryW(UTF_8::convert_to_utf16(path).c_str())
@@ -24,6 +25,7 @@
2425
#define CLOSE_LIB(var) dlclose(var)
2526

2627
#endif
28+
#endif
2729

2830
namespace Sass {
2931

src/sass.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
# endif
3939
#endif
4040

41+
// enable loading of plugins for non-wasm
42+
#ifndef _WASM
43+
# define ENABLE_LOAD_PLUGINS
44+
#endif
45+
4146
// path separation char
4247
#ifndef PATH_SEP
4348
# ifdef _WIN32

0 commit comments

Comments
 (0)