Skip to content

Commit f86f283

Browse files
xzyfernschonni
authored andcommitted
Bump LibSass@3.5.3 (sass#2342)
* Bump LibSass@3.5.3 See https://github.com/sass/libsass/releases/tag/3.5.3 * Workaround sass-spec A patch landed in sass-spec that is not compatible with 3.5.
1 parent 81291be commit f86f283

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+19533
-100
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "node-sass",
3-
"version": "4.9.2",
4-
"libsass": "3.5.4",
3+
"version": "4.8.3",
4+
"libsass": "3.5.3",
55
"description": "Wrapper around libsass",
66
"license": "MIT",
77
"bugs": "https://github.com/sass/node-sass/issues",
@@ -82,7 +82,7 @@
8282
"object-merge": "^2.5.1",
8383
"read-yaml": "^1.0.0",
8484
"rimraf": "^2.5.2",
85-
"sass-spec": "3.5.4-1",
85+
"sass-spec": "3.5.1",
8686
"unique-temp-dir": "^1.0.0"
8787
}
8888
}

src/libsass/Readme.md

Lines changed: 13 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,20 @@
1-
LibSass - Sass compiler written in C++
2-
======================================
1+
Welcome to the LibSass documentation!
32

4-
Currently maintained by Marcel Greter ([@mgreter]) and Michael Mifsud ([@xzyfer])
5-
Originally created by Aaron Leung ([@akhleung]) and Hampton Catlin ([@hcatlin])
3+
## First Off
4+
LibSass is just a library. To run the code locally (i.e. to compile your stylesheets), you need an implementer. SassC (get it?) is an implementer written in C. There are a number of other implementations of LibSass - for example Node. We encourage you to write your own port - the whole point of LibSass is that we want to bring Sass to many other languages, not just Ruby!
65

7-
[![Unix CI](https://travis-ci.org/sass/libsass.svg?branch=master)](https://travis-ci.org/sass/libsass "Travis CI")
8-
[![Windows CI](https://ci.appveyor.com/api/projects/status/github/sass/libsass?svg=true)](https://ci.appveyor.com/project/sass/libsass/branch/master "Appveyor CI")
9-
[![Coverage Status](https://img.shields.io/coveralls/sass/libsass.svg)](https://coveralls.io/r/sass/libsass?branch=feature%2Ftest-travis-ci-3 "Code coverage of spec tests")
10-
[![Percentage of issues still open](http://isitmaintained.com/badge/open/sass/libsass.svg)](http://isitmaintained.com/project/sass/libsass "Percentage of issues still open")
11-
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/sass/libsass.svg)](http://isitmaintained.com/project/sass/libsass "Average time to resolve an issue")
12-
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=283068)](https://www.bountysource.com/trackers/283068-libsass?utm_source=283068&utm_medium=shield&utm_campaign=TRACKER_BADGE "Bountysource")
13-
[![Join us](https://libsass-slack.herokuapp.com/badge.svg)](https://libsass-slack.herokuapp.com/ "Slack communication channels")
6+
We're working hard on moving to full parity with Ruby Sass... learn more at the [The-LibSass-Compatibility-Plan](compatibility-plan.md)!
147

8+
### Implementing LibSass
159

16-
[LibSass](https://github.com/sass/libsass "LibSass GitHub Project") is just a library!
17-
If you want to use LibSass to compile Sass, you need an implementer. Some
18-
implementations are only bindings into other programming languages. But most also
19-
ship with a command line interface (CLI) you can use directly. There is also
20-
[SassC](https://github.com/sass/sassc), which is the official lightweight
21-
CLI tool built by the same people as LibSass.
10+
If you're interested in implementing LibSass in your own project see the [API Documentation](api-doc.md) which now includes implementing
11+
your own [Sass functions](api-function.md). You may wish to [look at other implementations](implementations.md) for your language of choice.
12+
Or make your own!
2213

23-
### Excerpt of "sanctioned" implementations:
14+
### Contributing to LibSass
2415

25-
- https://github.com/sass/node-sass (Node.js)
26-
- https://github.com/sass/perl-libsass (Perl)
27-
- https://github.com/sass/libsass-python (Python)
28-
- https://github.com/wellington/go-libsass (Go)
29-
- https://github.com/sass/sassc-ruby (Ruby)
30-
- https://github.com/sass/libsass-net (C#)
31-
- https://github.com/medialize/sass.js (JS)
32-
- https://github.com/bit3/jsass (Java)
16+
| Issue Tracker | Issue Triage | Community Guidelines |
17+
|-------------------|----------------------------------|-----------------------------|
18+
| We're always needing help, so check out our issue tracker, help some people out, and read our article on [Contributing](contributing.md)! It's got all the details on what to do! | To help understand the process of triaging bugs, have a look at our [Issue-Triage](triage.md) document. | Oh, and don't forget we always follow [[Sass Community Guidelines|http://sass-lang.com/community-guidelines]]. Be nice and everyone else will be nice too! |
3319

34-
This list does not say anything about the quality of either the listed or not listed [implementations](docs/implementations.md)!
35-
The authors of the listed projects above are just known to work regularly together with LibSass developers.
36-
37-
About
38-
-----
39-
40-
LibSass is a C++ port of the original Ruby Sass CSS compiler with a [C API](docs/api-doc.md).
41-
We coded LibSass with portability and efficiency in mind. You can expect LibSass to be a lot
42-
faster than Ruby Sass and on par or faster than the best alternative CSS compilers around.
43-
44-
Developing
45-
----------
46-
47-
As noted above, the LibSass repository does not contain any binaries or other way to execute
48-
LibSass. Therefore, you need an implementer to develop LibSass. Easiest is to start with
49-
the official [SassC](http://github.com/sass/sassc) CLI wrapper. It is *guaranteed* to compile
50-
with the latest code in LibSass master, since it is also used in the CI process. There is no
51-
limitation here, as you may use any other LibSass implementer to test your LibSass branch!
52-
53-
Testing
54-
-------
55-
56-
Since LibSass is a pure library, tests are run through the [Sass-Spec](https://github.com/sass/sass-spec)
57-
project using the [SassC](http://github.com/sass/sassc) CLI wrapper. To run the tests against LibSass while
58-
developing, you can run `./script/spec`. This will clone SassC and Sass-Spec under the project folder and
59-
then run the Sass-Spec test suite. You may want to update the clones to ensure you have the latest version.
60-
Note that the scripts in the `./script` folder are mainly intended for our CI needs.
61-
62-
Building
63-
--------
64-
65-
To build LibSass you need GCC 4.6+ or Clang/LLVM. If your OS is older, you may need to upgrade
66-
them first (or install clang as an alternative). On Windows, you need MinGW with GCC 4.6+ or VS 2013
67-
Update 4+. It is also possible to build LibSass with Clang/LLVM on Windows with various build chains
68-
and/or command line interpreters.
69-
70-
See the [build docs for further instructions](docs/build.md)!
71-
72-
Compatibility
73-
-------------
74-
75-
Current LibSass 3.4 should be compatible with Sass 3.4. Please refer to the [sass compatibility
76-
page](http://sass-compatibility.github.io/) for a more detailed comparison. But note that there
77-
are still a few incomplete edges which we are aware of. Otherwise LibSass has reached a good level
78-
of stability, thanks to our ever growing [Sass-Spec test suite](https://github.com/sass/sass-spec).
79-
80-
About Sass
81-
----------
82-
83-
Sass is a CSS pre-processor language to add on exciting, new, awesome features to CSS. Sass was
84-
the first language of its kind and by far the most mature and up to date codebase.
85-
86-
Sass was originally conceived of by the co-creator of this library, Hampton Catlin ([@hcatlin]).
87-
Most of the language has been the result of years of work by Natalie Weizenbaum ([@nex3]) and
88-
Chris Eppstein ([@chriseppstein]).
89-
90-
For more information about Sass itself, please visit http://sass-lang.com
91-
92-
Initial development of LibSass by Aaron Leung and Hampton Catlin was supported by [Moovweb](http://www.moovweb.com).
93-
94-
Licensing
95-
---------
96-
97-
Our [MIT license](LICENSE) is designed to be as simple and liberal as possible.
98-
99-
[@hcatlin]: https://github.com/hcatlin
100-
[@akhleung]: https://github.com/akhleung
101-
[@chriseppstein]: https://github.com/chriseppstein
102-
[@nex3]: https://github.com/nex3
103-
[@mgreter]: https://github.com/mgreter
104-
[@xzyfer]: https://github.com/xzyfer
20+
Please refer to the steps on [Building LibSass](build.md)

src/libsass/api-context-example.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Example main.c
2+
3+
```C
4+
#include <stdio.h>
5+
#include "sass/context.h"
6+
7+
int main( int argc, const char* argv[] )
8+
{
9+
10+
// get the input file from first argument or use default
11+
const char* input = argc > 1 ? argv[1] : "styles.scss";
12+
13+
// create the file context and get all related structs
14+
struct Sass_File_Context* file_ctx = sass_make_file_context(input);
15+
struct Sass_Context* ctx = sass_file_context_get_context(file_ctx);
16+
struct Sass_Options* ctx_opt = sass_context_get_options(ctx);
17+
18+
// configure some options ...
19+
sass_option_set_precision(ctx_opt, 10);
20+
21+
// context is set up, call the compile step now
22+
int status = sass_compile_file_context(file_ctx);
23+
24+
// print the result or the error to the stdout
25+
if (status == 0) puts(sass_context_get_output_string(ctx));
26+
else puts(sass_context_get_error_message(ctx));
27+
28+
// release allocated memory
29+
sass_delete_file_context(file_ctx);
30+
31+
// exit status
32+
return status;
33+
34+
}
35+
```
36+
37+
### Compile main.c
38+
39+
```bash
40+
gcc -c main.c -o main.o
41+
gcc -o sample main.o -lsass
42+
echo "foo { margin: 21px * 2; }" > foo.scss
43+
./sample foo.scss => "foo { margin: 42px }"
44+
```
45+
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
```C
2+
// Input behaviours
3+
enum Sass_Input_Style {
4+
SASS_CONTEXT_NULL,
5+
SASS_CONTEXT_FILE,
6+
SASS_CONTEXT_DATA,
7+
SASS_CONTEXT_FOLDER
8+
};
9+
10+
// sass config options structure
11+
struct Sass_Inspect_Options {
12+
13+
// Output style for the generated css code
14+
// A value from above SASS_STYLE_* constants
15+
enum Sass_Output_Style output_style;
16+
17+
// Precision for fractional numbers
18+
int precision;
19+
20+
};
21+
22+
// sass config options structure
23+
struct Sass_Output_Options : Sass_Inspect_Options {
24+
25+
// String to be used for indentation
26+
const char* indent;
27+
// String to be used to for line feeds
28+
const char* linefeed;
29+
30+
// Emit comments in the generated CSS indicating
31+
// the corresponding source line.
32+
bool source_comments;
33+
34+
};
35+
36+
// sass config options structure
37+
struct Sass_Options : Sass_Output_Options {
38+
39+
// embed sourceMappingUrl as data uri
40+
bool source_map_embed;
41+
42+
// embed include contents in maps
43+
bool source_map_contents;
44+
45+
// create file urls for sources
46+
bool source_map_file_urls;
47+
48+
// Disable sourceMappingUrl in css output
49+
bool omit_source_map_url;
50+
51+
// Treat source_string as sass (as opposed to scss)
52+
bool is_indented_syntax_src;
53+
54+
// The input path is used for source map
55+
// generation. It can be used to define
56+
// something with string compilation or to
57+
// overload the input file path. It is
58+
// set to "stdin" for data contexts and
59+
// to the input file on file contexts.
60+
char* input_path;
61+
62+
// The output path is used for source map
63+
// generation. LibSass will not write to
64+
// this file, it is just used to create
65+
// information in source-maps etc.
66+
char* output_path;
67+
68+
// Colon-separated list of paths
69+
// Semicolon-separated on Windows
70+
// Maybe use array interface instead?
71+
char* include_path;
72+
char* plugin_path;
73+
74+
// Include paths (linked string list)
75+
struct string_list* include_paths;
76+
// Plugin paths (linked string list)
77+
struct string_list* plugin_paths;
78+
79+
// Path to source map file
80+
// Enables source map generation
81+
// Used to create sourceMappingUrl
82+
char* source_map_file;
83+
84+
// Directly inserted in source maps
85+
char* source_map_root;
86+
87+
// Custom functions that can be called from sccs code
88+
Sass_Function_List c_functions;
89+
90+
// Callback to overload imports
91+
Sass_Importer_List c_importers;
92+
93+
// List of custom headers
94+
Sass_Importer_List c_headers;
95+
96+
};
97+
98+
// base for all contexts
99+
struct Sass_Context : Sass_Options
100+
{
101+
102+
// store context type info
103+
enum Sass_Input_Style type;
104+
105+
// generated output data
106+
char* output_string;
107+
108+
// generated source map json
109+
char* source_map_string;
110+
111+
// error status
112+
int error_status;
113+
char* error_json;
114+
char* error_text;
115+
char* error_message;
116+
// error position
117+
char* error_file;
118+
size_t error_line;
119+
size_t error_column;
120+
const char* error_src;
121+
122+
// report imported files
123+
char** included_files;
124+
125+
};
126+
127+
// struct for file compilation
128+
struct Sass_File_Context : Sass_Context {
129+
130+
// no additional fields required
131+
// input_path is already on options
132+
133+
};
134+
135+
// struct for data compilation
136+
struct Sass_Data_Context : Sass_Context {
137+
138+
// provided source string
139+
char* source_string;
140+
char* srcmap_string;
141+
142+
};
143+
144+
// Compiler states
145+
enum Sass_Compiler_State {
146+
SASS_COMPILER_CREATED,
147+
SASS_COMPILER_PARSED,
148+
SASS_COMPILER_EXECUTED
149+
};
150+
151+
// link c and cpp context
152+
struct Sass_Compiler {
153+
// progress status
154+
Sass_Compiler_State state;
155+
// original c context
156+
Sass_Context* c_ctx;
157+
// Sass::Context
158+
Sass::Context* cpp_ctx;
159+
// Sass::Block
160+
Sass::Block_Obj root;
161+
};
162+
```
163+

0 commit comments

Comments
 (0)