Skip to content

Commit 7734584

Browse files
committed
Update documentation and prepare 3.2.1 release
1 parent 67fef67 commit 7734584

File tree

8 files changed

+149
-35
lines changed

8 files changed

+149
-35
lines changed

Build.PL

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ if (-d ".git") {
1818
system "git submodule update";
1919
open $manifest, ">", "MANIFEST" or die "MANIFEST: $!";
2020
print $manifest "MANIFEST\n";
21+
print $manifest "libsass/VERSION\n";
2122
while (my $module = shift @modules)
2223
{
2324
my $cwd = getcwd;
@@ -192,7 +193,7 @@ my %config = (
192193
},
193194
meta_merge => {
194195
resources => {
195-
repository => 'https://github.com/caldwell/CSS-Sass',
196+
repository => 'https://github.com/sass/CSS-Sass',
196197
},
197198
},
198199
add_to_cleanup => [ 'CSS-Sass-*' ],

Changes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
CSS::Sass (3.2.1)
2+
3+
* Update some outdated documentation
4+
* Add missing version file for libsass
5+
* Silence some compiler warnings
6+
17
CSS::Sass (3.2.0)
28

39
* Update to latest libsass release (3.2.0)

bin/psass.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ ()
180180
# get benchmark stamp after compiling
181181
my $t1 = $benchmark ? Benchmark->new : 0;
182182
# only print benchmark result when module is available
183-
if ($benchmark) { print timestr(timediff($t1, $t0)), "\n"; }
183+
if ($benchmark) { print timestr(timediff($t1, $t0), 'auto', '5.4f'), "\n"; }
184184

185185
# process return status values
186186
if (defined $css)

lib/CSS/Sass.md

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CSS::Sass - Compile .scss files using libsass
2020

2121
# Compile string and get css output and source-map json
2222
$sass->options->{source_map_file} = 'output.css.map';
23-
($css, $srcmap) = $sass->compile('A { color: foobar(); }');
23+
($css, $stats) = $sass->compile('A { color: foobar(); }');
2424

2525

2626
# Object Oriented API w/ options
@@ -35,7 +35,7 @@ CSS::Sass - Compile .scss files using libsass
3535
});
3636

3737
# Compile string and use the registered function
38-
my ($css, $srcmap) = $sass->compile('A { color: foobar(red); }');
38+
my ($css, $stats) = $sass->compile('A { color: foobar(red); }');
3939

4040
# Result can be undef because 'dont_die' was set
4141
warn $sass->last_error unless (defined $css);
@@ -45,18 +45,18 @@ CSS::Sass - Compile .scss files using libsass
4545
use CSS::Sass qw(:Default sass_compile);
4646

4747
# Functional API, with error messages and source-map
48-
my ($css, $err, $srcmap) = sass_compile('A { color: red; }');
48+
my ($css, $err, $stats) = sass_compile('A { color: red; }');
4949
die $err if defined $err;
5050

5151
# Functional API, simple, with no error messages
5252
my $css = sass_compile('A { color: red; }');
5353
die unless defined $css;
5454

5555
# Functional API w/ options
56-
my ($css, $err, $srcmap) = sass_compile('A { color: red; }',
57-
include_paths => ['some/include/path'],
58-
output_style => SASS_STYLE_NESTED,
59-
source_map_file => 'output.css.map');
56+
my ($css, $err, $stats) = sass_compile('A { color: red; }',
57+
include_paths => ['some/include/path'],
58+
output_style => SASS_STYLE_NESTED,
59+
source_map_file => 'output.css.map');
6060

6161
# Import sass2scss function
6262
use CSS::Sass qw(sass2scss);
@@ -74,7 +74,7 @@ CSS::Sass - Compile .scss files using libsass
7474
# DESCRIPTION
7575

7676
CSS::Sass provides a perl interface to libsass, a fairly complete Sass
77-
compiler written in C++. It is currently somewhere around ruby sass 3.2/3.3
77+
compiler written in C++. It is currently somewhere around ruby sass 3.3/3.4
7878
feature parity and heading towards 3.4. It can compile .scss and .sass files.
7979

8080
# OBJECT ORIENTED INTERFACE
@@ -115,22 +115,59 @@ feature parity and heading towards 3.4. It can compile .scss and .sass files.
115115
# FUNCTIONAL INTERFACE
116116

117117
- `$css = sass_compile(source_code, options)`
118-
- `($css, $err, $srcmap) = sass_compile(source_code, options)`
118+
- `($css, $err, $stats) = sass_compile(source_code, options)`
119119

120-
Compiles the given Sass source code. It returns CSS, error and source-map in
121-
list context or just the CSS in scalar context. Either CSS or error will be
122-
`undef`, but never both.
120+
Compiles the sass code given by `source_code`. It returns CSS, error and a
121+
status object in list context or just the CSS in scalar context. Either CSS
122+
or error will be `undef`, but never both.
123+
124+
- `$css = sass_compile_file(input_path, options)`
125+
- `($css, $err, $stats) = sass_compile_file(input_path, options)`
126+
127+
Compiles the sass file given by `input_path`. It returns CSS, error and a
128+
status object in list context or just the CSS in scalar context. Either CSS
129+
or error will be `undef`, but never both.
130+
131+
- $stats status hash:
132+
133+
The status hash holds usefull information after compilation:
134+
135+
- `error_status`
136+
- `output_string`
137+
- `included_files`
138+
- `source_map_string`
139+
- `error_line`
140+
- `error_column`
141+
- `error_src`
142+
- `error_file`
143+
- `error_text`
144+
- `error_message`
145+
- `error_json`
123146

124147
# OPTIONS
125148

126149
- `output_style`
127150

128151
- `SASS_STYLE_NESTED`
152+
- `SASS_STYLE_COMPACT`
153+
- `SASS_STYLE_EXPANDED`
129154
- `SASS_STYLE_COMPRESSED`
130155

131156
The default is `SASS_STYLE_NESTED`. Set to `SASS_STYLE_COMPRESSED` to
132157
eliminate all whitespace (for your production CSS).
133158

159+
- `precision`
160+
161+
Set the floating point precision for output.
162+
163+
- `linefeed`
164+
165+
Set the linefeed string used for css output.
166+
167+
- `indentation`
168+
169+
Set the indentation string used for css output.
170+
134171
- `source_comments`
135172

136173
Set to `true` to get extra comments in the output, indicating what input
@@ -231,6 +268,17 @@ feature parity and heading towards 3.4. It can compile .scss and .sass files.
231268
];
232269
}
233270

271+
You may also return `undef` to skip the importer (usefull if an importer only handles
272+
certain url protocols). With the latest libsass version, you can add multiple importers
273+
with a priority order to implement more complex scenarios (highly experimental).
274+
275+
- Custom `headers`
276+
277+
Another highly experimental feature to prepend content on every compilation. It can be
278+
used to predefine mixins or other stuff. Internally the content is really just added to
279+
the top of the processed data. Custom headers have the same structure as importers. But
280+
all registered headers are called in the order given by the priority flag.
281+
234282
- `Sass_Value` Types
235283

236284
Sass knowns various `Sass_Value` types. We export the constants for completeness.

lib/CSS/Sass.pm

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ our @EXPORT = qw(
5050
SASS2SCSS_CONVERT_COMMENT
5151
);
5252

53-
our $VERSION = "v3.2.0";
53+
our $VERSION = "v3.2.1";
5454

5555
require XSLoader;
5656
XSLoader::load('CSS::Sass', $VERSION);
@@ -193,7 +193,7 @@ CSS::Sass - Compile .scss files using libsass
193193
194194
# Compile string and get css output and source-map json
195195
$sass->options->{source_map_file} = 'output.css.map';
196-
($css, $srcmap) = $sass->compile('A { color: foobar(); }');
196+
($css, $stats) = $sass->compile('A { color: foobar(); }');
197197
198198
199199
# Object Oriented API w/ options
@@ -208,7 +208,7 @@ CSS::Sass - Compile .scss files using libsass
208208
});
209209
210210
# Compile string and use the registered function
211-
my ($css, $srcmap) = $sass->compile('A { color: foobar(red); }');
211+
my ($css, $stats) = $sass->compile('A { color: foobar(red); }');
212212
213213
# Result can be undef because 'dont_die' was set
214214
warn $sass->last_error unless (defined $css);
@@ -218,18 +218,18 @@ CSS::Sass - Compile .scss files using libsass
218218
use CSS::Sass qw(:Default sass_compile);
219219
220220
# Functional API, with error messages and source-map
221-
my ($css, $err, $srcmap) = sass_compile('A { color: red; }');
221+
my ($css, $err, $stats) = sass_compile('A { color: red; }');
222222
die $err if defined $err;
223223
224224
# Functional API, simple, with no error messages
225225
my $css = sass_compile('A { color: red; }');
226226
die unless defined $css;
227227
228228
# Functional API w/ options
229-
my ($css, $err, $srcmap) = sass_compile('A { color: red; }',
230-
include_paths => ['some/include/path'],
231-
output_style => SASS_STYLE_NESTED,
232-
source_map_file => 'output.css.map');
229+
my ($css, $err, $stats) = sass_compile('A { color: red; }',
230+
include_paths => ['some/include/path'],
231+
output_style => SASS_STYLE_NESTED,
232+
source_map_file => 'output.css.map');
233233
234234
# Import sass2scss function
235235
use CSS::Sass qw(sass2scss);
@@ -247,7 +247,7 @@ CSS::Sass - Compile .scss files using libsass
247247
=head1 DESCRIPTION
248248
249249
CSS::Sass provides a perl interface to libsass, a fairly complete Sass
250-
compiler written in C++. It is currently somewhere around ruby sass 3.2/3.3
250+
compiler written in C++. It is currently somewhere around ruby sass 3.3/3.4
251251
feature parity and heading towards 3.4. It can compile .scss and .sass files.
252252
253253
=head1 OBJECT ORIENTED INTERFACE
@@ -295,11 +295,49 @@ Allows you to inspect or change the options after a call to C<new>.
295295
296296
=item C<$css = sass_compile(source_code, options)>
297297
298-
=item C<($css, $err, $srcmap) = sass_compile(source_code, options)>
298+
=item C<($css, $err, $stats) = sass_compile(source_code, options)>
299299
300-
Compiles the given Sass source code. It returns CSS, error and source-map in
301-
list context or just the CSS in scalar context. Either CSS or error will be
302-
C<undef>, but never both.
300+
Compiles the sass code given by C<source_code>. It returns CSS, error and a
301+
status object in list context or just the CSS in scalar context. Either CSS
302+
or error will be C<undef>, but never both.
303+
304+
=item C<$css = sass_compile_file(input_path, options)>
305+
306+
=item C<($css, $err, $stats) = sass_compile_file(input_path, options)>
307+
308+
Compiles the sass file given by C<input_path>. It returns CSS, error and a
309+
status object in list context or just the CSS in scalar context. Either CSS
310+
or error will be C<undef>, but never both.
311+
312+
=item $stats status hash:
313+
314+
The status hash holds usefull information after compilation:
315+
316+
=over
317+
318+
=item C<error_status>
319+
320+
=item C<output_string>
321+
322+
=item C<included_files>
323+
324+
=item C<source_map_string>
325+
326+
=item C<error_line>
327+
328+
=item C<error_column>
329+
330+
=item C<error_src>
331+
332+
=item C<error_file>
333+
334+
=item C<error_text>
335+
336+
=item C<error_message>
337+
338+
=item C<error_json>
339+
340+
=back
303341
304342
=back
305343
@@ -313,6 +351,10 @@ C<undef>, but never both.
313351
314352
=item C<SASS_STYLE_NESTED>
315353
354+
=item C<SASS_STYLE_COMPACT>
355+
356+
=item C<SASS_STYLE_EXPANDED>
357+
316358
=item C<SASS_STYLE_COMPRESSED>
317359
318360
=back
@@ -432,6 +474,17 @@ A simple example:
432474
];
433475
}
434476
477+
You may also return C<undef> to skip the importer (usefull if an importer only handles
478+
certain url protocols). With the latest libsass version, you can add multiple importers
479+
with a priority order to implement more complex scenarios (highly experimental).
480+
481+
=item Custom C<headers>
482+
483+
Another highly experimental feature to prepend content on every compilation. It can be
484+
used to predefine mixins or other stuff. Internally the content is really just added to
485+
the top of the processed data. Custom headers have the same structure as importers. But
486+
all registered headers are called in the order given by the priority flag.
487+
435488
=item C<Sass_Value> Types
436489
437490
Sass knowns various C<Sass_Value> types. We export the constants for completeness.
@@ -531,7 +584,7 @@ L<The CSS::Sass Home Page|https://github.com/sass/perl-libsass>
531584
532585
=head1 AUTHOR
533586
534-
David Caldwell E<lt>[email protected]E<gt>
587+
David Caldwell E<lt>[email protected]E<gt>
535588
Marcel Greter E<lt>[email protected]E<gt>
536589
537590
=head1 LICENSE

lib/CSS/Sass/Type.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use CSS::Sass;
2727

2828
################################################################################
2929
package CSS::Sass::Type;
30-
our $VERSION = "v3.2.0";
30+
our $VERSION = "v3.2.1";
3131
################################################################################
3232
use CSS::Sass qw(import_sv);
3333
################################################################################
@@ -406,7 +406,7 @@ L<CSS::Sass>
406406
407407
=head1 AUTHOR
408408
409-
David Caldwell E<lt>[email protected]E<gt>
409+
David Caldwell E<lt>[email protected]E<gt>
410410
Marcel Greter E<lt>[email protected]E<gt>
411411
412412
=head1 LICENSE

lib/CSS/Sass/Watchdog.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use CSS::Sass;
77

88
################################################################################
99
package CSS::Sass::Watchdog;
10-
our $VERSION = "v3.2.0";
10+
our $VERSION = "v3.2.1";
1111
################################################################################
1212

1313
use Exporter 'import'; # gives you Exporter's import() method directly
@@ -352,7 +352,7 @@ L<CSS::Sass>
352352
353353
=head1 AUTHOR
354354
355-
David Caldwell E<lt>[email protected]E<gt>
355+
David Caldwell E<lt>[email protected]E<gt>
356356
Marcel Greter E<lt>[email protected]E<gt>
357357
358358
=head1 LICENSE

t/04_xs_value_types.t

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ is $error_msg->message, 'message', "error message method return ok";
314314

315315
test_string($regex);
316316

317-
is $regex, '"'.qr/regex/.'"', "regex stringify value is correct";
317+
SKIP: {
318+
skip (1) if $] < 5.011000;
319+
is $regex, '"'.qr/regex/.'"', "regex stringify value is correct";
320+
}
318321

319322
################################################################################
320323
################################################################################
@@ -443,8 +446,11 @@ is $sass->compile('$bol: test-bol(var-pl-new-boolean()); A { value: $bol; }'),
443446
is $sass->compile('$err: test-err(var-pl-new-error()); A { value: $err; }'),
444447
undef, 'test returned blessed variable of type error';
445448

446-
is $sass->compile('$rgx: test-str(var-pl-regex()); A { value: $rgx; }'),
447-
"A{value:".qr/foobar/."}\n", 'test returned blessed variable of type "regex"';
449+
SKIP: {
450+
skip (1) if $] < 5.011000;
451+
is $sass->compile('$rgx: test-str(var-pl-regex()); A { value: $rgx; }'),
452+
"A{value:".qr/foobar/."}\n", 'test returned blessed variable of type "regex"';
453+
}
448454
449455
################################################################################
450456
$sass->options->{'dont_die'} = 0;

0 commit comments

Comments
 (0)