Skip to content

Commit 21facf0

Browse files
committed
Implement new output options for tool
1 parent 41d2e24 commit 21facf0

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Build.PL

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ my %config = (
211211
extend.cpp file.cpp output.cpp parser.cpp prelexer.cpp emitter.cpp position.cpp
212212
sass.cpp sass_interface.cpp sass_functions.cpp sass_values.cpp sass_context.cpp
213213
source_map.cpp to_c.cpp to_string.cpp units.cpp utf8_string.cpp util.cpp cssize.cpp
214+
contextualize_eval.cpp listize.cpp
214215
) ]
215216
},
216217
config => { ld => 'c++' }, # Need to link with a C++ linker since libsass is C++ (even though the .xs file is not)

bin/psass.pl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
use File::Slurp qw(write_file);
1919

2020
# load constants from libsass
21+
use CSS::Sass qw(SASS_STYLE_EXPANDED);
2122
use CSS::Sass qw(SASS_STYLE_NESTED);
2223
use CSS::Sass qw(SASS_STYLE_COMPRESSED);
24+
use CSS::Sass qw(SASS_STYLE_COMPACT);
2325
use CSS::Sass::Watchdog qw(start_watchdog);
2426

2527
####################################################################################################
@@ -84,8 +86,12 @@ sub version {
8486
# parse string to constant
8587
elsif ($output_style =~ m/^n/i)
8688
{ $output_style = SASS_STYLE_NESTED }
87-
elsif ($output_style =~ m/^c/i)
89+
elsif ($output_style =~ m/^compa/i)
90+
{ $output_style = SASS_STYLE_COMPACT }
91+
elsif ($output_style =~ m/^compr/i)
8892
{ $output_style = SASS_STYLE_COMPRESSED }
93+
elsif ($output_style =~ m/^e/i)
94+
{ $output_style = SASS_STYLE_EXPANDED }
8995
# die with message if style is unknown
9096
else { die "unknown output style: $output_style" }
9197

@@ -197,7 +203,7 @@ =head1 SYNOPSIS
197203
-w, --watch start watchdog mode
198204
-p, --precision precision for float output
199205
-o, --output-file=file output file to write result to
200-
-t, --output-style=style output style [nested|compressed]
206+
-t, --output-style=style output style [expanded|nested|compressed|compact]
201207
-L, --plugin-path=path plugin load path (repeatable)
202208
-I, --include-path=path sass include path (repeatable)
203209
-c, --source-comments enable source debug comments

lib/CSS/Sass.xs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ struct Sass_Import** sass_importer(const char* url, const char* prev, void* cook
364364
char* source = 0;
365365
char* mapjson = 0;
366366
char* error_msg = 0;
367-
size_t error_line = 0;
368-
size_t error_column = 0;
367+
size_t error_line = -1;
368+
size_t error_column = -1;
369369

370370
// get the entry from the array
371371
// can either be another array or a path string
@@ -579,6 +579,7 @@ void finalize_sass_context(struct Sass_Context* ctx, HV* RETVAL, SV* err)
579579
size_t error_column = sass_context_get_error_column(ctx);
580580
const char* error_text = sass_context_get_error_text(ctx);
581581
const char* error_message = sass_context_get_error_message(ctx);
582+
const char* error_src = 0; // sass_context_get_error_src(ctx);
582583
const char* output_string = sass_context_get_output_string(ctx);
583584
const char* source_map_string = sass_context_get_source_map_string(ctx);
584585
char** included_files = sass_context_get_included_files(ctx);
@@ -595,6 +596,7 @@ void finalize_sass_context(struct Sass_Context* ctx, HV* RETVAL, SV* err)
595596
hv_stores(RETVAL, "source_map_string", source_map_string ? newSVpv(source_map_string, 0) : newSV(0));
596597
hv_stores(RETVAL, "error_line", SvOK(err) ? err : error_line ? newSViv(error_line) : newSViv(0));
597598
hv_stores(RETVAL, "error_column", SvOK(err) ? err : error_column ? newSViv(error_column) : newSViv(0));
599+
hv_stores(RETVAL, "error_src", SvOK(err) ? err : error_src ? newSVpv(error_src, 0) : newSViv(0));
598600
hv_stores(RETVAL, "error_text", SvOK(err) ? err : error_text ? newSVpv(error_text, 0) : newSV(0));
599601
hv_stores(RETVAL, "error_message", SvOK(err) ? err : error_message ? newSVpv(error_message, 0) : newSV(0));
600602
hv_stores(RETVAL, "error_json", SvOK(err) ? err : error_json ? newSVpv(error_json, 0) : newSV(0));

0 commit comments

Comments
 (0)