sassc 1.10.1 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/ext/libsass/.github/CONTRIBUTING.md +65 -0
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +29 -0
- data/ext/libsass/Makefile +8 -3
- data/ext/libsass/Makefile.conf +28 -22
- data/ext/libsass/Readme.md +14 -7
- data/ext/libsass/configure.ac +5 -8
- data/ext/libsass/docs/api-context-internal.md +3 -0
- data/ext/libsass/docs/api-context.md +7 -0
- data/ext/libsass/docs/api-doc.md +4 -0
- data/ext/libsass/docs/api-importer.md +2 -0
- data/ext/libsass/docs/api-value-example.md +55 -0
- data/ext/libsass/docs/api-value.md +49 -22
- data/ext/libsass/docs/implementations.md +4 -0
- data/ext/libsass/include/sass/base.h +5 -4
- data/ext/libsass/include/sass/context.h +3 -0
- data/ext/libsass/include/sass/values.h +28 -27
- data/ext/libsass/include/sass/version.h +1 -1
- data/ext/libsass/include/sass2scss.h +1 -1
- data/ext/libsass/script/ci-build-libsass +3 -3
- data/ext/libsass/script/ci-install-deps +12 -3
- data/ext/libsass/src/ast.cpp +321 -212
- data/ext/libsass/src/ast.hpp +273 -165
- data/ext/libsass/src/ast_factory.hpp +4 -5
- data/ext/libsass/src/ast_fwd_decl.hpp +8 -7
- data/ext/libsass/src/bind.cpp +2 -7
- data/ext/libsass/src/bind.hpp +0 -1
- data/ext/libsass/src/check_nesting.cpp +379 -0
- data/ext/libsass/src/check_nesting.hpp +60 -0
- data/ext/libsass/src/constants.cpp +7 -6
- data/ext/libsass/src/constants.hpp +2 -1
- data/ext/libsass/src/context.cpp +7 -1
- data/ext/libsass/src/context.hpp +1 -1
- data/ext/libsass/src/cssize.cpp +76 -32
- data/ext/libsass/src/cssize.hpp +7 -8
- data/ext/libsass/src/debugger.hpp +70 -40
- data/ext/libsass/src/error_handling.cpp +15 -2
- data/ext/libsass/src/error_handling.hpp +19 -0
- data/ext/libsass/src/eval.cpp +107 -161
- data/ext/libsass/src/eval.hpp +12 -8
- data/ext/libsass/src/expand.cpp +81 -74
- data/ext/libsass/src/expand.hpp +13 -12
- data/ext/libsass/src/extend.cpp +149 -142
- data/ext/libsass/src/extend.hpp +10 -3
- data/ext/libsass/src/file.cpp +2 -1
- data/ext/libsass/src/functions.cpp +96 -59
- data/ext/libsass/src/functions.hpp +2 -2
- data/ext/libsass/src/inspect.cpp +33 -45
- data/ext/libsass/src/inspect.hpp +7 -7
- data/ext/libsass/src/json.cpp +17 -5
- data/ext/libsass/src/lexer.cpp +3 -3
- data/ext/libsass/src/listize.cpp +10 -10
- data/ext/libsass/src/listize.hpp +3 -3
- data/ext/libsass/src/node.cpp +30 -30
- data/ext/libsass/src/node.hpp +13 -13
- data/ext/libsass/src/operation.hpp +21 -19
- data/ext/libsass/src/output.cpp +48 -103
- data/ext/libsass/src/output.hpp +0 -1
- data/ext/libsass/src/parser.cpp +161 -133
- data/ext/libsass/src/parser.hpp +10 -7
- data/ext/libsass/src/remove_placeholders.cpp +6 -6
- data/ext/libsass/src/remove_placeholders.hpp +1 -1
- data/ext/libsass/src/sass.cpp +21 -0
- data/ext/libsass/src/sass.hpp +8 -1
- data/ext/libsass/src/sass2scss.cpp +14 -3
- data/ext/libsass/src/sass_context.cpp +69 -24
- data/ext/libsass/src/sass_context.hpp +3 -0
- data/ext/libsass/src/source_map.cpp +22 -10
- data/ext/libsass/src/to_value.cpp +2 -2
- data/ext/libsass/src/to_value.hpp +1 -1
- data/ext/libsass/src/units.hpp +3 -1
- data/ext/libsass/src/util.cpp +20 -16
- data/ext/libsass/src/util.hpp +2 -1
- data/ext/libsass/win/libsass.targets +2 -0
- data/ext/libsass/win/libsass.vcxproj.filters +6 -0
- data/lib/sassc/engine.rb +5 -0
- data/lib/sassc/native/native_functions_api.rb +13 -1
- data/lib/sassc/script/value_conversion.rb +11 -1
- data/lib/sassc/script/value_conversion/list.rb +23 -0
- data/lib/sassc/version.rb +1 -1
- data/test/engine_test.rb +18 -2
- data/test/functions_test.rb +30 -0
- data/test/native_test.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bbf189c8dd82c9e7a55454104b1ccdd03590bf0
|
4
|
+
data.tar.gz: 2cee2d1a55a747b4e873079e184964c84bee4fdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8128f57ef6fcafe9faacc7998411590c028b4946f60faddea2c9154885206707784cf20dcfabc254bb25bc47c10334e338019625ed4050f42136b32e495115e
|
7
|
+
data.tar.gz: 4870de37197958d7bdbfa4b95d3f7574da5754ff93148c4f1d0a7a9c42b8070b85d28f4faa4158537b2dd2464bb7c62a11285c99a9ab118e64502e622ddabdd3
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ This gem combines the speed of `libsass`, the [Sass C implementation](https://gi
|
|
6
6
|
|
7
7
|
### libsass Version
|
8
8
|
|
9
|
-
[3.
|
9
|
+
[3.4.0](https://github.com/sass/libsass/releases/tag/3.4.0)
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -49,6 +49,9 @@ and [awesome contributors](https://github.com/bolandrm/sassc-ruby/graphs/contrib
|
|
49
49
|
|
50
50
|
## Changelog
|
51
51
|
|
52
|
+
- **1.11.0**
|
53
|
+
- [Add support for lists in functions](https://github.com/sass/sassc-ruby/pull/55)
|
54
|
+
- [Update to libsass 3.4.0](https://github.com/sass/sassc-ruby/pull/57)
|
52
55
|
- **1.10.1**
|
53
56
|
- [Add sourcemap getter](https://github.com/sass/sassc-ruby/pull/48)
|
54
57
|
- **1.10.0**
|
@@ -102,7 +105,7 @@ and [awesome contributors](https://github.com/bolandrm/sassc-ruby/graphs/contrib
|
|
102
105
|
|
103
106
|
### Code Changes
|
104
107
|
|
105
|
-
1. Fork it ( https://github.com/
|
108
|
+
1. Fork it ( https://github.com/sass/sassc-ruby/fork )
|
106
109
|
1. Create your feature branch (`git checkout -b my-new-feature`)
|
107
110
|
1. Commit your changes (`git commit -am 'Add some feature'`) - try to include tests
|
108
111
|
1. Push to the branch (`git push origin my-new-feature`)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Contributing to LibSass
|
2
|
+
|
3
|
+
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
|
4
|
+
|
5
|
+
The following is a set of guidelines for contributing to LibSass, which is hosted in the [Sass Organization](https://github.com/sass) on GitHub.
|
6
|
+
These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request.
|
7
|
+
|
8
|
+
LibSass is a library that implements a [sass language] [8] compiler. As such it does not directly interface with end users (frontend developers).
|
9
|
+
For direct contributions to the LibSass code base you will need to have at least a rough idea of C++, we will not lie about that.
|
10
|
+
But there are other ways to contribute to the progress of LibSass. All contributions are done via github pull requests.
|
11
|
+
|
12
|
+
You can also contribute to the LibSass [documentation] [9] or provide additional [spec tests] [10] (and we will gladly point you in the
|
13
|
+
direction for corners that lack test coverage). Foremost we rely on good and concise bug reports for issues the spec tests do not yet catch.
|
14
|
+
|
15
|
+
## Precheck: My Sass isn't compiling
|
16
|
+
- [ ] Check if you can reproduce the issue via [SourceMap Inspector] [5] (updated regularly).
|
17
|
+
- [ ] Validate official ruby sass compiler via [SassMeister] [6] produces your expected result.
|
18
|
+
- [ ] Search for similar issue in [LibSass] [1] and [node-sass] [2] (include closed tickets)
|
19
|
+
- [ ] Optionally test your code directly with [sass] [7] or [sassc] [3] ([installer] [4])
|
20
|
+
|
21
|
+
## Precheck: My build/install fails
|
22
|
+
- [ ] Problems with building or installing libsass should be directed to implementors first!
|
23
|
+
- [ ] Except for issues directly verified via sassc or LibSass own build (make/autotools9
|
24
|
+
|
25
|
+
## Craft a meaningfull error report
|
26
|
+
- [ ] Include the version of libsass and the implementor (i.e. node-sass or sassc)
|
27
|
+
- [ ] Include information about your operating system and environment (i.e. io.js)
|
28
|
+
- [ ] Either create a self contained sample that shows your issue ...
|
29
|
+
- [ ] ... or provide it as a fetchable (github preferred) archive/repo
|
30
|
+
- [ ] ... and include a step by step list of command to get all dependencies
|
31
|
+
- [ ] Make it clear if you use indented or/and scss syntax
|
32
|
+
|
33
|
+
## My error is hiding in a big code base
|
34
|
+
1. we do not have time to support your code base!
|
35
|
+
2. to fix occuring issues we need precise bug reports
|
36
|
+
3. the more precise you are, the faster we can help you
|
37
|
+
4. lazy reports get overlooked even when exposing serious bugs
|
38
|
+
5. it's not hard to do, it only takes time
|
39
|
+
- [ ] Make sure you saved the current state (i.e. commit to git)
|
40
|
+
- [ ] Start by uncommenting blocks in the initial source file
|
41
|
+
- [ ] Check if the problem is still there after each edit
|
42
|
+
- [ ] Repeat until the problem goes away
|
43
|
+
- [ ] Inline imported files as you go along
|
44
|
+
- [ ] Finished once you cannot remove more
|
45
|
+
- [ ] The emphasis is on the word "repeat" ...
|
46
|
+
|
47
|
+
## What makes a code test case
|
48
|
+
|
49
|
+
Important is that someone else can get the test case up and running to reproduce it locally. For this
|
50
|
+
we urge you to verify that your sample yields the expected result by testing it via [SassMeister] [6]
|
51
|
+
or directly via ruby sass or node-sass (or any other libsass implementor) before submitting your bug
|
52
|
+
report. Once you verified all of the above, you may use the template below to file your bug report.
|
53
|
+
|
54
|
+
|
55
|
+
[1]: https://github.com/sass/libsass/issues?utf8=%E2%9C%93&q=is%3Aissue
|
56
|
+
[2]: https://github.com/sass/node-sass/issues?utf8=%E2%9C%93&q=is%3Aissue
|
57
|
+
[3]: https://github.com/sass/sassc
|
58
|
+
[4]: http://libsass.ocbnet.ch/installer/
|
59
|
+
[5]: http://libsass.ocbnet.ch/srcmap/
|
60
|
+
[6]: http://www.sassmeister.com/
|
61
|
+
[7]: https://rubygems.org/gems/sass
|
62
|
+
|
63
|
+
[8]: http://sass-lang.com/
|
64
|
+
[9]: https://github.com/sass/libsass/tree/master/docs
|
65
|
+
[10]: https://github.com/sass/sass-spec
|
@@ -0,0 +1,29 @@
|
|
1
|
+
### Title: Be as meaningful as possible in 60 chars if possible
|
2
|
+
|
3
|
+
input.scss
|
4
|
+
```scss
|
5
|
+
test {
|
6
|
+
content: bar
|
7
|
+
}
|
8
|
+
```
|
9
|
+
|
10
|
+
[libsass 3.5.5] [1]
|
11
|
+
```css
|
12
|
+
test {
|
13
|
+
content: bar; }
|
14
|
+
```
|
15
|
+
|
16
|
+
ruby sass 3.4.21
|
17
|
+
```css
|
18
|
+
test {
|
19
|
+
content: bar; }
|
20
|
+
```
|
21
|
+
|
22
|
+
version info:
|
23
|
+
```cmd
|
24
|
+
$ node-sass --version
|
25
|
+
node-sass 3.3.3 (Wrapper) [JavaScript]
|
26
|
+
libsass 3.2.5 (Sass Compiler) [C/C++]
|
27
|
+
```
|
28
|
+
|
29
|
+
[1]: http://libsass.ocbnet.ch/srcmap/#dGVzdCB7CiAgY29udGVudDogYmFyOyB9Cg==
|
data/ext/libsass/Makefile
CHANGED
@@ -125,13 +125,18 @@ endif
|
|
125
125
|
|
126
126
|
ifneq (Windows,$(UNAME))
|
127
127
|
ifneq (FreeBSD,$(UNAME))
|
128
|
-
|
129
|
-
|
128
|
+
ifneq (OpenBSD,$(UNAME))
|
129
|
+
LDFLAGS += -ldl
|
130
|
+
LDLIBS += -ldl
|
131
|
+
endif
|
130
132
|
endif
|
131
133
|
endif
|
132
134
|
|
133
135
|
ifneq ($(BUILD),shared)
|
134
|
-
BUILD
|
136
|
+
BUILD := static
|
137
|
+
endif
|
138
|
+
ifeq ($(DEBUG),1)
|
139
|
+
BUILD := debug-$(BUILD)
|
135
140
|
endif
|
136
141
|
|
137
142
|
ifeq (,$(TRAVIS_BUILD_DIR))
|
data/ext/libsass/Makefile.conf
CHANGED
@@ -1,32 +1,38 @@
|
|
1
1
|
# this is merely a common Makefile multiple implementers can use
|
2
|
+
# bigger files (in terms of compile time) tend to go to the top,
|
3
|
+
# so they don't end up as the last compile unit when compiling
|
4
|
+
# in parallel. But we also want to mix them a little too avoid
|
5
|
+
# heavy RAM usage peaks. Other than that the order is arbitrary.
|
6
|
+
|
2
7
|
|
3
8
|
SOURCES = \
|
4
9
|
ast.cpp \
|
5
|
-
|
6
|
-
bind.cpp \
|
7
|
-
color_maps.cpp \
|
8
|
-
constants.cpp \
|
10
|
+
node.cpp \
|
9
11
|
context.cpp \
|
10
|
-
|
11
|
-
|
12
|
+
constants.cpp \
|
13
|
+
functions.cpp \
|
14
|
+
color_maps.cpp \
|
12
15
|
environment.cpp \
|
13
|
-
|
14
|
-
eval.cpp \
|
15
|
-
expand.cpp \
|
16
|
-
extend.cpp \
|
16
|
+
bind.cpp \
|
17
17
|
file.cpp \
|
18
|
-
|
19
|
-
inspect.cpp \
|
18
|
+
util.cpp \
|
20
19
|
json.cpp \
|
21
|
-
|
22
|
-
|
23
|
-
memory_manager.cpp \
|
24
|
-
node.cpp \
|
25
|
-
output.cpp \
|
26
|
-
parser.cpp \
|
20
|
+
units.cpp \
|
21
|
+
values.cpp \
|
27
22
|
plugins.cpp \
|
28
23
|
position.cpp \
|
24
|
+
lexer.cpp \
|
25
|
+
parser.cpp \
|
29
26
|
prelexer.cpp \
|
27
|
+
eval.cpp \
|
28
|
+
expand.cpp \
|
29
|
+
listize.cpp \
|
30
|
+
cssize.cpp \
|
31
|
+
extend.cpp \
|
32
|
+
output.cpp \
|
33
|
+
inspect.cpp \
|
34
|
+
emitter.cpp \
|
35
|
+
check_nesting.cpp \
|
30
36
|
remove_placeholders.cpp \
|
31
37
|
sass.cpp \
|
32
38
|
sass_util.cpp \
|
@@ -34,12 +40,12 @@ SOURCES = \
|
|
34
40
|
sass_context.cpp \
|
35
41
|
sass_functions.cpp \
|
36
42
|
sass2scss.cpp \
|
37
|
-
source_map.cpp \
|
38
43
|
to_c.cpp \
|
39
44
|
to_value.cpp \
|
40
|
-
|
45
|
+
source_map.cpp \
|
46
|
+
error_handling.cpp \
|
47
|
+
memory_manager.cpp \
|
41
48
|
utf8_string.cpp \
|
42
|
-
|
43
|
-
util.cpp
|
49
|
+
base64vlq.cpp
|
44
50
|
|
45
51
|
CSOURCES = cencode.c
|
data/ext/libsass/Readme.md
CHANGED
@@ -3,7 +3,7 @@ LibSass
|
|
3
3
|
|
4
4
|
by Aaron Leung ([@akhleung]), Hampton Catlin ([@hcatlin]), Marcel Greter ([@mgreter]) and Michael Mifsud ([@xzyfer])
|
5
5
|
|
6
|
-
[![
|
6
|
+
[![Unix CI](https://travis-ci.org/sass/libsass.svg?branch=master)](https://travis-ci.org/sass/libsass)
|
7
7
|
[![Windows CI](https://ci.appveyor.com/api/projects/status/github/sass/libsass?svg=true)](https://ci.appveyor.com/project/sass/libsass/branch/master)
|
8
8
|
[![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)
|
9
9
|
[![Coverage Status](https://img.shields.io/coveralls/sass/libsass.svg)](https://coveralls.io/r/sass/libsass?branch=feature%2Ftest-travis-ci-3)
|
@@ -34,9 +34,9 @@ As you may have noticed, the LibSass repo itself has
|
|
34
34
|
no executables and no tests. Oh noes! How can you develop???
|
35
35
|
|
36
36
|
Well, luckily, [SassC](http://github.com/sass/sassc) is the official binary wrapper for
|
37
|
-
LibSass and is *always* kept in sync. SassC
|
38
|
-
|
39
|
-
|
37
|
+
LibSass and is *always* kept in sync. SassC is used by continous integration systems in
|
38
|
+
LibSass repository. When developing LibSass, it is best to actually
|
39
|
+
checkout SassC and develop in that directory with the SassC spec
|
40
40
|
and tests there.
|
41
41
|
|
42
42
|
We even run Travis tests for SassC!
|
@@ -48,6 +48,12 @@ Since LibSass is a pure library, tests are run through the [SassSpec](https://gi
|
|
48
48
|
|
49
49
|
To run tests against LibSass while developing, you can run `./script/spec`. This will clone SassC and Sass-Spec under the project folder and then run the Sass-Spec test suite. You may want to update the clones to ensure you have the latest version.
|
50
50
|
|
51
|
+
### DEBUG builds
|
52
|
+
|
53
|
+
Set the environment variable `DEBUG` to `1` to enable debug builds that can be debugged
|
54
|
+
with `gdb`, `lldb` and others. E.g.: use `$ DEBUG=1 ./script/spec` to run the tests with
|
55
|
+
a debug build.
|
56
|
+
|
51
57
|
Library Usage
|
52
58
|
-------------
|
53
59
|
|
@@ -81,12 +87,13 @@ Licensing
|
|
81
87
|
|
82
88
|
Our MIT license is designed to be as simple, and liberal as possible.
|
83
89
|
|
90
|
+
sass2scss was originally written by [Marcel Greter][@mgreter]
|
91
|
+
and he happily agreed to have it merged into the project.
|
92
|
+
|
93
|
+
|
84
94
|
[@hcatlin]: https://github.com/hcatlin
|
85
95
|
[@akhleung]: https://github.com/akhleung
|
86
96
|
[@chriseppstein]: https://github.com/chriseppstein
|
87
97
|
[@nex3]: https://github.com/nex3
|
88
98
|
[@mgreter]: https://github.com/mgreter
|
89
99
|
[@xzyfer]: https://github.com/xzyfer
|
90
|
-
|
91
|
-
sass2scss was originally written by [Marcel Greter](@mgreter)
|
92
|
-
and he happily agreed to have it merged into the project.
|
data/ext/libsass/configure.ac
CHANGED
@@ -13,8 +13,6 @@ AC_CONFIG_AUX_DIR([script])
|
|
13
13
|
# Though they look like gcc flags!
|
14
14
|
AM_INIT_AUTOMAKE([foreign parallel-tests -Wall])
|
15
15
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
|
16
|
-
# would fail with mingw otherwise
|
17
|
-
# m4_pattern_allow([AM_PROG_AR])
|
18
16
|
|
19
17
|
# Checks for programs.
|
20
18
|
AC_PROG_CC
|
@@ -25,11 +23,10 @@ AC_GNU_SOURCE
|
|
25
23
|
# Check fails on Travis, but it works fine
|
26
24
|
# AX_CXX_COMPILE_STDCXX_11([ext],[optional])
|
27
25
|
AC_CHECK_TOOL([AR], [ar], [false])
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
fi
|
26
|
+
AC_CHECK_TOOL([DLLTOOL], [dlltool], [false])
|
27
|
+
AC_CHECK_TOOL([DLLWRAP], [dllwrap], [false])
|
28
|
+
AC_CHECK_TOOL([WINDRES], [windres], [false])
|
29
|
+
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
33
30
|
LT_INIT([dlopen])
|
34
31
|
|
35
32
|
# Checks for header files.
|
@@ -46,7 +43,7 @@ AC_CHECK_FUNCS([floor getcwd strtol])
|
|
46
43
|
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests], [enable testing the build]),
|
47
44
|
[enable_tests="$enableval"], [enable_tests=no])
|
48
45
|
|
49
|
-
AS_CASE([$
|
46
|
+
AS_CASE([$host], [*-*-mingw*], [is_mingw32=yes], [is_mingw32=no])
|
50
47
|
AM_CONDITIONAL(COMPILER_IS_MINGW32, test "x$is_mingw32" = "xyes")
|
51
48
|
|
52
49
|
dnl The dlopen() function is in the C library for *BSD and in
|
@@ -34,6 +34,10 @@ bool source_map_embed;
|
|
34
34
|
bool source_map_contents;
|
35
35
|
```
|
36
36
|
```C
|
37
|
+
// create file urls for sources
|
38
|
+
bool source_map_file_urls;
|
39
|
+
```
|
40
|
+
```C
|
37
41
|
// Disable sourceMappingUrl in css output
|
38
42
|
bool omit_source_map_url;
|
39
43
|
```
|
@@ -174,6 +178,7 @@ int sass_compiler_execute (struct Sass_Compiler* compiler);
|
|
174
178
|
// Release all memory allocated with the compiler
|
175
179
|
// This does _not_ include any contexts or options
|
176
180
|
void sass_delete_compiler (struct Sass_Compiler* compiler);
|
181
|
+
void sass_delete_options(struct Sass_Options* options);
|
177
182
|
|
178
183
|
// Release all memory allocated and also ourself
|
179
184
|
void sass_delete_file_context (struct Sass_File_Context* ctx);
|
@@ -224,6 +229,7 @@ enum Sass_Output_Style sass_option_get_output_style (struct Sass_Options* option
|
|
224
229
|
bool sass_option_get_source_comments (struct Sass_Options* options);
|
225
230
|
bool sass_option_get_source_map_embed (struct Sass_Options* options);
|
226
231
|
bool sass_option_get_source_map_contents (struct Sass_Options* options);
|
232
|
+
bool sass_option_get_source_map_file_urls (struct Sass_Options* options);
|
227
233
|
bool sass_option_get_omit_source_map_url (struct Sass_Options* options);
|
228
234
|
bool sass_option_get_is_indented_syntax_src (struct Sass_Options* options);
|
229
235
|
const char* sass_option_get_indent (struct Sass_Options* options);
|
@@ -243,6 +249,7 @@ void sass_option_set_output_style (struct Sass_Options* options, enum Sass_Outpu
|
|
243
249
|
void sass_option_set_source_comments (struct Sass_Options* options, bool source_comments);
|
244
250
|
void sass_option_set_source_map_embed (struct Sass_Options* options, bool source_map_embed);
|
245
251
|
void sass_option_set_source_map_contents (struct Sass_Options* options, bool source_map_contents);
|
252
|
+
void sass_option_set_source_map_file_urls (struct Sass_Options* options, bool source_map_file_urls);
|
246
253
|
void sass_option_set_omit_source_map_url (struct Sass_Options* options, bool omit_source_map_url);
|
247
254
|
void sass_option_set_is_indented_syntax_src (struct Sass_Options* options, bool is_indented_syntax_src);
|
248
255
|
void sass_option_set_indent (struct Sass_Options* options, const char* indent);
|
data/ext/libsass/docs/api-doc.md
CHANGED
@@ -130,6 +130,10 @@ char* sass_resolve_file (const char* path, const char* incs[]);
|
|
130
130
|
|
131
131
|
// Get compiled libsass version
|
132
132
|
const char* libsass_version(void);
|
133
|
+
|
134
|
+
// Implemented sass language version
|
135
|
+
// Hardcoded version 3.4 for time being
|
136
|
+
const char* libsass_language_version(void);
|
133
137
|
```
|
134
138
|
|
135
139
|
## Common Pitfalls
|
@@ -11,6 +11,8 @@ rv[0] = sass_make_import(rel, abs, source, srcmap);
|
|
11
11
|
|
12
12
|
Every import will then be included in LibSass. You are allowed to only return a file path without any loaded source. This way you can ie. implement rewrite rules for import paths and leave the loading part for LibSass.
|
13
13
|
|
14
|
+
Please note that LibSass doesn't use the srcmap parameter yet. It has been added to not deprecate the C-API once support has been implemented. It will be used to re-map the actual sourcemap with the provided ones.
|
15
|
+
|
14
16
|
### Basic Usage
|
15
17
|
|
16
18
|
```C
|
@@ -0,0 +1,55 @@
|
|
1
|
+
## Example operation.c
|
2
|
+
|
3
|
+
```C
|
4
|
+
#include <stdio.h>
|
5
|
+
#include <string.h>
|
6
|
+
#include "sass/values.h"
|
7
|
+
|
8
|
+
int main( int argc, const char* argv[] )
|
9
|
+
{
|
10
|
+
|
11
|
+
// create two new sass values to be added
|
12
|
+
union Sass_Value* string = sass_make_string("String");
|
13
|
+
union Sass_Value* number = sass_make_number(42, "nits");
|
14
|
+
|
15
|
+
// invoke the add operation which returns a new sass value
|
16
|
+
union Sass_Value* total = sass_value_op(ADD, string, number);
|
17
|
+
|
18
|
+
// no further use for the two operands
|
19
|
+
sass_delete_value(string);
|
20
|
+
sass_delete_value(number);
|
21
|
+
|
22
|
+
// this works since libsass will always return a
|
23
|
+
// string for add operations with a string as the
|
24
|
+
// left hand side. But you should never rely on it!
|
25
|
+
puts(sass_string_get_value(total));
|
26
|
+
|
27
|
+
// invoke stringification (uncompressed with precision of 5)
|
28
|
+
union Sass_Value* result = sass_value_stringify(total, false, 5);
|
29
|
+
|
30
|
+
// no further use for the sum
|
31
|
+
sass_delete_value(total);
|
32
|
+
|
33
|
+
// print the result - you may want to make
|
34
|
+
// sure result is indeed a string, altough
|
35
|
+
// stringify guarantees to return a string
|
36
|
+
// if (sass_value_is_string(result)) {}
|
37
|
+
// really depends on your level of paranoia
|
38
|
+
puts(sass_string_get_value(result));
|
39
|
+
|
40
|
+
// finally free result
|
41
|
+
sass_delete_value(result);
|
42
|
+
|
43
|
+
// exit status
|
44
|
+
return 0;
|
45
|
+
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## Compile operation.c
|
50
|
+
|
51
|
+
```bash
|
52
|
+
gcc -c operation.c -o operation.o
|
53
|
+
gcc -o operation operation.o -lsass
|
54
|
+
./operation # => String42nits
|
55
|
+
```
|
@@ -1,4 +1,11 @@
|
|
1
|
-
`Sass_Values` are used to pass values and their types between the implementer
|
1
|
+
`Sass_Values` are used to pass values and their types between the implementer
|
2
|
+
and LibSass. Sass knows various different value types (including nested arrays
|
3
|
+
and hash-maps). If you implement a binding to another programming language, you
|
4
|
+
have to find a way to [marshal] [1] (convert) `Sass_Values` between the target
|
5
|
+
language and C. `Sass_Values` are currently only used by custom functions, but
|
6
|
+
it should also be possible to use them without a compiler context.
|
7
|
+
|
8
|
+
[1]: https://en.wikipedia.org/wiki/Marshalling_%28computer_science%29
|
2
9
|
|
3
10
|
### Basic Usage
|
4
11
|
|
@@ -23,7 +30,18 @@ enum Sass_Tag {
|
|
23
30
|
// Tags for denoting Sass list separators
|
24
31
|
enum Sass_Separator {
|
25
32
|
SASS_COMMA,
|
26
|
-
SASS_SPACE
|
33
|
+
SASS_SPACE,
|
34
|
+
// only used internally to represent a hash map before evaluation
|
35
|
+
// otherwise we would be too early to check for duplicate keys
|
36
|
+
SASS_HASH
|
37
|
+
};
|
38
|
+
|
39
|
+
// Value Operators
|
40
|
+
enum Sass_OP {
|
41
|
+
AND, OR, // logical connectives
|
42
|
+
EQ, NEQ, GT, GTE, LT, LTE, // arithmetic relations
|
43
|
+
ADD, SUB, MUL, DIV, MOD, // arithmetic functions
|
44
|
+
NUM_OPS // so we know how big to make the op table
|
27
45
|
};
|
28
46
|
```
|
29
47
|
|
@@ -33,6 +51,32 @@ enum Sass_Separator {
|
|
33
51
|
// Forward declaration
|
34
52
|
union Sass_Value;
|
35
53
|
|
54
|
+
// Creator functions for all value types
|
55
|
+
union Sass_Value* sass_make_null (void);
|
56
|
+
union Sass_Value* sass_make_boolean (bool val);
|
57
|
+
union Sass_Value* sass_make_string (const char* val);
|
58
|
+
union Sass_Value* sass_make_qstring (const char* val);
|
59
|
+
union Sass_Value* sass_make_number (double val, const char* unit);
|
60
|
+
union Sass_Value* sass_make_color (double r, double g, double b, double a);
|
61
|
+
union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep);
|
62
|
+
union Sass_Value* sass_make_map (size_t len);
|
63
|
+
union Sass_Value* sass_make_error (const char* msg);
|
64
|
+
union Sass_Value* sass_make_warning (const char* msg);
|
65
|
+
|
66
|
+
// Generic destructor function for all types
|
67
|
+
// Will release memory of all associated Sass_Values
|
68
|
+
// Means we will delete recursively for lists and maps
|
69
|
+
void sass_delete_value (union Sass_Value* val);
|
70
|
+
|
71
|
+
// Make a deep cloned copy of the given sass value
|
72
|
+
union Sass_Value* sass_clone_value (const union Sass_Value* val);
|
73
|
+
|
74
|
+
// Stringify a Sass_Values and also return the result as a Sass_Value (of type STRING)
|
75
|
+
union Sass_Value* sass_value_stringify (const union Sass_Value* a, bool compressed, int precision);
|
76
|
+
|
77
|
+
// Execute an operation for two Sass_Values and return the result as a Sass_Value too
|
78
|
+
union Sass_Value* sass_value_op (enum Sass_OP op, const union Sass_Value* a, const union Sass_Value* b);
|
79
|
+
|
36
80
|
// Return the sass tag for a generic sass value
|
37
81
|
// Check is needed before accessing specific values!
|
38
82
|
enum Sass_Tag sass_value_get_tag (const union Sass_Value* v);
|
@@ -58,6 +102,8 @@ void sass_number_set_unit (union Sass_Value* v, char* unit);
|
|
58
102
|
// Getters and setters for Sass_String
|
59
103
|
const char* sass_string_get_value (const union Sass_Value* v);
|
60
104
|
void sass_string_set_value (union Sass_Value* v, char* value);
|
105
|
+
bool sass_string_is_quoted(const union Sass_Value* v);
|
106
|
+
void sass_string_set_quoted(union Sass_Value* v, bool quoted);
|
61
107
|
|
62
108
|
// Getters and setters for Sass_Boolean
|
63
109
|
bool sass_boolean_get_value (const union Sass_Value* v);
|
@@ -84,7 +130,7 @@ void sass_list_set_value (union Sass_Value* v, size_t i, union Sass_Value* value
|
|
84
130
|
|
85
131
|
// Getter for the number of items in map
|
86
132
|
size_t sass_map_get_length (const union Sass_Value* v);
|
87
|
-
// Getters and setters for
|
133
|
+
// Getters and setters for Sass_Map keys and values
|
88
134
|
union Sass_Value* sass_map_get_key (const union Sass_Value* v, size_t i);
|
89
135
|
void sass_map_set_key (union Sass_Value* v, size_t i, union Sass_Value*);
|
90
136
|
union Sass_Value* sass_map_get_value (const union Sass_Value* v, size_t i);
|
@@ -97,25 +143,6 @@ void sass_error_set_message (union Sass_Value* v, char* msg);
|
|
97
143
|
// Getters and setters for Sass_Warning
|
98
144
|
char* sass_warning_get_message (const union Sass_Value* v);
|
99
145
|
void sass_warning_set_message (union Sass_Value* v, char* msg);
|
100
|
-
|
101
|
-
// Creator functions for all value types
|
102
|
-
union Sass_Value* sass_make_null (void);
|
103
|
-
union Sass_Value* sass_make_boolean (bool val);
|
104
|
-
union Sass_Value* sass_make_string (const char* val);
|
105
|
-
union Sass_Value* sass_make_number (double val, const char* unit);
|
106
|
-
union Sass_Value* sass_make_color (double r, double g, double b, double a);
|
107
|
-
union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep);
|
108
|
-
union Sass_Value* sass_make_map (size_t len);
|
109
|
-
union Sass_Value* sass_make_error (const char* msg);
|
110
|
-
union Sass_Value* sass_make_warning (const char* msg);
|
111
|
-
|
112
|
-
// Generic destructor function for all types
|
113
|
-
// Will release memory of all associated Sass_Values
|
114
|
-
// Means we will delete recursively for lists and maps
|
115
|
-
void sass_delete_value (union Sass_Value* val);
|
116
|
-
|
117
|
-
// Make a deep cloned copy of the given sass value
|
118
|
-
union Sass_Value* sass_clone_value (const union Sass_Value* val);
|
119
146
|
```
|
120
147
|
|
121
148
|
### More links
|