Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sass_option_push_include_path #166

Merged
merged 1 commit into from
Apr 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 2 additions & 32 deletions sassc.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ int main(int argc, char** argv) {
bool generate_source_map = false;
struct Sass_Options* options = sass_make_options();
sass_option_set_output_style(options, SASS_STYLE_NESTED);
char *include_paths = NULL;
char *plugin_paths = NULL;
sass_option_set_precision(options, 5);

int c, i;
Expand All @@ -237,32 +235,10 @@ int main(int argc, char** argv) {
from_stdin = 1;
break;
case 'I':
if (!include_paths) {
#ifdef _MSC_VER
include_paths = _strdup(optarg);
#else
include_paths = strdup(optarg);
#endif
} else {
char *old_paths = include_paths;
include_paths = malloc(strlen(old_paths) + 1 + strlen(optarg) + 1);
sprintf(include_paths, "%s%c%s", old_paths, PATH_SEP, optarg);
free(old_paths);
}
sass_option_push_include_path(options, strdup(optarg));
break;
case 'P':
if (!plugin_paths) {
#ifdef _MSC_VER
plugin_paths = _strdup(optarg);
#else
plugin_paths = strdup(optarg);
#endif
} else {
char *old_paths = plugin_paths;
plugin_paths = malloc(strlen(old_paths) + 1 + strlen(optarg) + 1);
sprintf(plugin_paths, "%s%c%s", old_paths, PATH_SEP, optarg);
free(old_paths);
}
sass_option_push_plugin_path(options, strdup(optarg));
break;
case 't':
for(i = 0; i < NUM_STYLE_OPTION_STRINGS; ++i) {
Expand Down Expand Up @@ -309,9 +285,6 @@ int main(int argc, char** argv) {
}
}

sass_option_set_include_path(options, include_paths ? include_paths : "");
sass_option_set_plugin_path(options, plugin_paths ? plugin_paths : "");

if(optind < argc - 2) {
fprintf(stderr, "Error: Too many arguments.\n");
invalid_usage(argv[0]);
Expand All @@ -337,8 +310,5 @@ int main(int argc, char** argv) {
result = compile_stdin(options, outfile);
}

free(include_paths);
free(plugin_paths);

return result;
}