pax_global_header00006660000000000000000000000064136147340640014522gustar00rootroot0000000000000052 comment=7fd984362284e8b0c74e8fea576e6a572167a3a3 sassphp-0.7/000077500000000000000000000000001361473406400130515ustar00rootroot00000000000000sassphp-0.7/.github/000077500000000000000000000000001361473406400144115ustar00rootroot00000000000000sassphp-0.7/.github/ISSUE_TEMPLATE/000077500000000000000000000000001361473406400165745ustar00rootroot00000000000000sassphp-0.7/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000015021361473406400212640ustar00rootroot00000000000000--- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. sassphp-0.7/.github/ISSUE_TEMPLATE/feature_request.md000066400000000000000000000011231361473406400223160ustar00rootroot00000000000000--- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. sassphp-0.7/.gitignore000066400000000000000000000006311361473406400150410ustar00rootroot00000000000000*~ *.swp *.lo *.la .deps .libs Makefile Makefile.fragments Makefile.global Makefile.objects acinclude.m4 aclocal.m4 autom4te.cache build config.cache config.guess config.h config.h.in config.log config.nice config.status config.sub configure configure.in conftest conftest.c include install-sh libtool ltmain.sh missing mkinstalldirs modules scan_makefile_in.awk *.dsw *.plg *.opt *.ncb run-tests.php test.phpsassphp-0.7/.gitmodules000066400000000000000000000001341361473406400152240ustar00rootroot00000000000000[submodule "lib/libsass"] path = lib/libsass url = https://github.com/hcatlin/libsass.git sassphp-0.7/.travis.yml000066400000000000000000000035551361473406400151720ustar00rootroot00000000000000language: php php: - 7.1 - 7.2 - 7.3 - 7.4 - nightly jobs: allow_failures: - php: nightly addons: apt: packages: - php-dev - gdb env: global: # Configure the .phpt tests to be Travis friendly - REPORT_EXIT_STATUS=1 - TEST_PHP_ARGS="-q -s output.txt -g XFAIL,FAIL,BORK,WARN,LEAK,SKIP -x --show-diff" # Add the pip installation folder to the PATH, until https://github.com/travis-ci/travis-ci/issues/3563 is fixed - PATH=$HOME/.local/bin:$PATH compiler: - gcc install: # What is the current file size max for core files? # It is usually 0, which means no core file will be dumped if there is a crash - ulimit -c before_install: - echo $LANG - echo $LC_ALL - composer require satooshi/php-coveralls --dev - git submodule init - git submodule update before_script: - travis_retry composer self-update - composer config discard-changes true - ulimit -c unlimited -S # enable core dumps script: - make clean - cd lib/libsass && make && cd ../.. - phpize - ./configure - make - echo "extension = sass.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${TRAVIS_BUILD_DIR}/modules" - make install - mkdir -p build/logs - phpunit --coverage-clover build/logs/clover.xml - make test || RESULT=$? - if [[ ${RESULT} == 0 ]]; then echo "\\o/ our test worked without problems"; else echo "ruhroh test returned an errorcode of $RESULT"; fi; - for i in $(find ./ -maxdepth 1 -name 'core*' -print); do gdb $(pwd)/test core* -ex "thread apply all bt" -ex "set pagination 0" -batch; done; - if [[ ${RESULT} != 0 ]]; then exit $RESULT ; fi; after_success: - travis_retry php vendor/bin/coveralls - bash <(curl -s https://codecov.io/bash) notifications: on_success: never on_failure: never os: - linux matrix: fast_finish: true sassphp-0.7/LICENSE000066400000000000000000000021751361473406400140630ustar00rootroot00000000000000Copyright (c) 2012 Jamie Rumbelow, portions Copyright (c) 2013 Philip Hofstetter portions Copyright (c) 2017 Lawrence Meckan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sassphp-0.7/README.md000066400000000000000000000233271361473406400143370ustar00rootroot00000000000000# sassphp The `sass` extension for PHP gives you an object-oriented system of parsing [Sass](http://sass-lang.com/) from within your PHP applications. Under the hood it uses [libsass](https://github.com/hcatlin/libsass) to provide super speedy and compatible Sass parsing. ![Libsass 3.6.3](https://img.shields.io/badge/libsass-3.6.3-yellow.svg) [![Build Status](https://travis-ci.org/absalomedia/sassphp.svg)](https://travis-ci.org/absalomedia/sassphp) [![codecov](https://codecov.io/gh/absalomedia/sassphp/branch/master/graph/badge.svg)](https://codecov.io/gh/absalomedia/sassphp) [![Patreon](https://img.shields.io/badge/patreon-donate-green.svg)](https://www.patreon.com/bePatron?u=14641360) ## What's Sass? Sass is a CSS pre-processor language to add on exciting, new, awesome features to CSS. Sass was the first language of its kind and by far the most mature and up to date codebase. Sass was originally created by Hampton Catlin ([@hcatlin](http://twitter.com/hcatlin)). The extension and continuing evolution of the language has all been the result of years of work by Natalie Weizenbaum ([@nex3](http://twitter.com/nex3)) and Chris Eppstein ([@chriseppstein](http://twitter.com/chriseppstein)). For more information about Sass itself, please visit [http://sass-lang.com](http://sass-lang.com) ## Installation Currently, the only way to install the extension is manually: $ git clone git://github.com/absalomedia/sassphp Remember to grab your submodules: $ git submodule init $ git submodule update Also remember that libsass now uses submodules on its own, so update those too. ...and compile it! I've written a little PHP script to do all the stuff you need to do: $ php install.php Run the tests: $ make test Finally, you can install with `make`: $ make install And then add it to your _php.ini_: extension=sass.so Always remember to enable it within PHP as well phpenmod sass ## Binary installation / deployment As long as you have the final 'sass.so' extension file, you can deploy SASS PHP across any server. There's a few caveats, of course. The development & production servers have to run the same version of PHP. You then copy the installed 'sass.so' from the /usr/lib/php/ directory shown during 'make install' on your development environment to the same directory on your production boxes. As usual, make sure you add the extension to your _php.ini_ on your production environments: extension=sass.so Always remember to enable it within PHP as well phpenmod sass ## Usage This extension has a very simple API: $sass = new Sass(); $css = $sass->compile($source); You can compile a file with `compileFile()`: $sass = new Sass(); $css = $sass->compileFile($source); You can set the include path for the library to use: $sass = new Sass(); $sass->setIncludePath('/tmp'); $css = $sass->compile($source); You can set the style of your SASS file to suit your needs: $sass = new Sass(); $sass->setStyle(Sass::STYLE_NESTED); $sass = new Sass(); $sass->setStyle(Sass::STYLE_EXPANDED); $sass = new Sass(); $sass->setStyle(Sass::STYLE_COMPACT); $sass = new Sass(); $sass->setStyle(Sass::STYLE_COMPRESSED); As the [Libsass](https://github.com/hcatlin/libsass) library has matured to get closer to 100% SASS coverage, so this extension has also matured: - SASS file compilation is an array when a source map file is specified. - The ability to define source comments - The ability to embed the source map into the CSS output - The ability to specify .SASS file input instead of .SCSS - The ability to set a source map path, required when generating a dedicated .map file - The ability to define a root directory for the source map itself - SASS importer & functions capabilities - PHP 7.0 to PHP 7.4 support, with tests for PHP 8 The output of `compileFile()` is an array when creating source map files, allowing both compiled SASS file and .map file to be generated in the same function call. As there are multiple ways of generating source comments, there are now PHP level settings to control that output. To generate source comments for a file inline: $sass = new Sass(); $sass->setComments(true); $css = $sass->compileFile($source); Aliases also exist so you can also use: $css = $sass->compile_file($source); You can tell the compiler to use indented syntax (SASS syntax). By default it expects SCSS syntax: $sass = new Sass(); $sass->setIndent(true); //TRUE -> SASS, FALSE -> SCSS $css = $sass->compile($source); You can tell the compiler to embed the source map into the actual CSS file as well: $sass = new Sass(); $sass->setEmbed(true); $css = $sass->compile($source); You can set the source map file for the library to use: $sass = new Sass(); $sass->setMapPath('/random.output.css.map'); $css = $sass->compileFile($source); This needs to be done prior to getting the output of the map file. As it stands, both the output of the SASS file compile & the SASS source map file generation sequence are both strings. The first array item will always be the compiled SASS file: \$css[0] The second array item will always be the source map output: \$css[1] You can set the root of the generated source map file like so: $sass = new Sass(); $sass->setMapRoot('/some/dir'); $sass->setMapPath('/random.output.css.map'); $css = $sass->compileFile($source); If there's a problem, the extension will throw a `SassException`: $sass = new Sass(); try { $css = $sass->compile('dayrui3dui36di37'); } catch (SassException $e) { // $e->getMessage() - ERROR -- , line 1: invalid top-level expression $css = FALSE; } ## Variant builds These extensions also utilise the [Libsass](https://github.com/hcatlin/libsass) library & remain in varying states of completion: - Facebook [HHVM](https://github.com/absalomedia/sasshhvm) native (non Zend) extension - with Libsass 3.5.5 - tested up to HHVM 3.11.x - [Nginx](https://github.com/absalomedia/sass-nginx-module) module - with Libsass 3.5.5 ## Changelog | Release | Description | | ------- | ----------------------------------------------------------------------------------------- | | 0.7.0 | Librarian - Functions & importers | | 0.6.2 | Solskjær - Manchester (Libsass 3.6.3) | | 0.6.1 | Bond - Monaco (Libsass 3.6.1) | | 0.6.0 | Symfony - Composer integration | | 0.5.17 | Engine - Vroom vroom (Libsass 3.5.5) | | 0.5.16 | Humpback - Maloo (Libsass 3.5.4) | | 0.5.15 | Fallout - Atom (Libsass 3.5.2) | | 0.5.14 | Karol - Caroline (Libsass 3.4.8) | | 0.5.13 | Ray - Manta (Libsass 3.4.5) & PHP stub file | | 0.5.12 | Cartography - MapRoot functions | | 0.5.11 | Zoomer (Libsass 3.4.4) stable | | 0.5.10 | Elwood (Libsass 3.4.3) stable & Travis fix | | 0.5.9 | Rickshaw (Libsass 3.4.2) stable | | 0.5.8 | AI - KITT (Libsass 3.4.0) stable | | 0.5.7 | Hancock - Optimise loops & Travis. Simplify changelog documentation | | 0.5.6 | Green Giant - PHP5 & PHP7 stable build - All Travis builds passing | | 0.5.5 | Herbie (Libsass 3.3.6) stable | | 0.5.2 | Delorean (Libsass 3.3.3) stable & continuing PHP7 rewrite | | 0.5.1 | Eleanor (Libsass 3.3.2) stable | | 0.5.0 | Start of PHP 7 compatibility | | 0.4.9 | Too Fast To Furious (Libsass 3.3.1) stable | | 0.4.8 | Greased Lightning (Libsass 3.3.0) stable | | 0.4.7 | SCSS vs SASS detection - indents | | 0.4.6 | Travis experimental (unreleased) | | 0.4.5 | Holiday Patch (Libsass 3.2.5) stable | | 0.4.4 | Refactor correctly for LibSass 3.2.4 | | 0.4.2 | CamelCase compile sequence | | 0.4.1 | Addition of SOURCE_DEFAULT test & structure. Revise other tests | | 0.4.0 | Refactor file compliation. Basic tests for source comments. Expand documentation | | 0.3.9 | Addition of source map url paths to SASS file compilation | | 0.3.5 | Restructure of compile sequence (file only at this time) to account for source map output | | 0.3.0 | Addition of source comments - none, inline, file. Set default to none. | | 0.2.0 | Changed methods to be non-static. Allow setting include-path and image-path | | 0.1.0 | Initial release | sassphp-0.7/Sassphp.sln000066400000000000000000000023631361473406400152140ustar00rootroot00000000000000 Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sassphp", "Sassphp.vcxproj", "{DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Debug|x64.ActiveCfg = Debug|x64 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Debug|x64.Build.0 = Debug|x64 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Debug|x86.ActiveCfg = Debug|Win32 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Debug|x86.Build.0 = Debug|Win32 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Release|x64.ActiveCfg = Release|x64 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Release|x64.Build.0 = Release|x64 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Release|x86.ActiveCfg = Release|Win32 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal sassphp-0.7/Sassphp.vcxproj000066400000000000000000000322031361473406400161070ustar00rootroot00000000000000 Debug Win32 Release Win32 Debug x64 Release x64 {DA0105A7-279B-4B5C-B8BC-39AABF5A2FBF} Win32Proj DynamicLibrary true v140 DynamicLibrary false v140 Application true v140 Application false v140 true true WIN32;_DEBUG;_WINDOWS;_USRDLL;SASSPHP_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level3 ProgramDatabase Disabled MachineX86 true Windows WIN32;NDEBUG;_WINDOWS;_USRDLL;SASSPHP_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL Level3 ProgramDatabase MachineX86 true Windows true true sassphp-0.7/Sassphp.vcxproj.filters000066400000000000000000000257451361473406400175730ustar00rootroot00000000000000 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files sassphp-0.7/appveyor.yml000066400000000000000000000016751361473406400154520ustar00rootroot00000000000000environment: PHP_VERSION: 7.3.13 configuration: Release version: '0.0.{build}' matrix: fast_finish: true install: - cd C:\projects\sassphp - git submodule init - git submodule update - cd C:\ - mkdir php-src - echo Preparing Windows build... - echo Downloading PHP source code [%PHP_VERSION%] - cd C:\php-src - appveyor DownloadFile http://windows.php.net/downloads/releases/php-7.3.13-src.zip -FileName php-src.zip - 7z x -y php-src.zip > nul - '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64' build_script: - cd C:\php-src\php-7.3.13-src - buildconf.bat --add-modules-dir=C:\projects - configure --disable-all --enable-cli --enable-sass - nmake php_sass.dll test: OFF test_script: OFF deploy: OFF - provider: Email to: - media@absalom.biz on_build_success: true on_build_failure: false on_build_status_changed: false artifacts: - path: ext\Release_TS\php_sass.dll sassphp-0.7/composer.json000066400000000000000000000021401361473406400155700ustar00rootroot00000000000000{ "name": "abm/sassphp", "type": "library", "description": "PHP bindings to libsass - fast, native Sass parsing in PHP!", "keywords": [ "sass", "php", "libsass", "extensions" ], "homepage": "https://github.com/absalomedia/sassphp", "license": "MIT", "authors": [ { "name": "Lawrence Meckan", "email": "media@absalom.biz" }, { "name": "Jamie Rumbelow", "email": "jamie@jamierumbelow.net" }, { "name": "Philip Hofstetter", "email": "phofstetter@sensational.ch" } ], "support": { "email": "media@absalom.biz", "wiki": "https://github.com/absalomedia/sassphp/blob/master/README.md" }, "require": { "php": ">=5.4.2" }, "require-dev": { "satooshi/php-coveralls": "~1.0", "phpunit/phpcov": "^3.1", "phpunit/phpunit": "^5.7" }, "scripts": { "post-install-cmd": [ "sh scripts/sassphp_install.sh" ] }, "replace": { "abm/sassphp": "self.version" } }sassphp-0.7/config.m4000066400000000000000000000015321361473406400145610ustar00rootroot00000000000000PHP_ARG_ENABLE(sass, [whether to enable sass extension], [ --enable-sass Enable sass extension], yes, yes) if test "$PHP_SASS" != "no"; then PHP_ADD_INCLUDE(lib/libsass/include) PHP_ADD_LIBRARY_WITH_PATH(sass, lib/libexec, LIBSASS_SHARED_LIBADD) LDFLAGS="-lsass -L"`pwd`"/lib/libsass/lib/ -lstdc++" # manually extract sass version as the non-autotool'ed # sass_version.h that comes with libsass doesn't contain # the version sass_version=$(cd lib/libsass && ./version.sh) if test "x$sass_version" != "x" ; then # escape hell. This is what we need to pass to the # compiler: -DLIBSASS_VERSION="\"'3.5.4\"" CFLAGS="-DLIBSASS_VERSION=\"\\\"$sass_version\\\"\" $CFLAGS" CXXFLAGS="-DLIBSASS_VERSION=\"\\\"$sass_version\\\"\" $CXXFLAGS" fi PHP_NEW_EXTENSION(sass, src/sass.c src/utilities.c, $ext_shared) fi sassphp-0.7/config.w32000066400000000000000000000010321361473406400146470ustar00rootroot00000000000000// vim:ft=javascript ARG_ENABLE("sass", "whether to enable sass extension", "yes"); if (PHP_SASS != "no") { if (CHECK_LIB("libsass.lib", "sass", PHP_SASS) && CHECK_HEADER_ADD_INCLUDE("sass.h", "CFLAGS_SODIUM")) { EXTENSION("sass", "/src/sass.c"); AC_DEFINE('HAVE_LIBSASSLIB', 1 , 'Have the SASS library'); AC_DEFINE("HAVE_CRYPTO_AEAD_AES256GCM", 1, ""); PHP_INSTALL_HEADERS("ext/sass/", "/src/php_sass.h"); } else { WARNING("libSass not enabled; libraries and headers not found"); } }sassphp-0.7/install.php000066400000000000000000000002041361473406400152240ustar00rootroot00000000000000 sass pecl.php.net SASS - Sass for PHP SASS compliation for PHP Lawrence Meckan absalomedia media@absalom.biz yes 2018-01-14 0.5.14 3.4.8 stable stable MIT License - 5.6.0-dev 1.10 sass 2018-01-14 0.5.14 3.4.8 stable stable MIT License - Update libsass to 3.4.8 - Start of work for PECL inclusion sassphp-0.7/phpunit.xml000066400000000000000000000016161361473406400152660ustar00rootroot00000000000000 ./tests/ ./tests/ ./tests ./vendor/ sassphp-0.7/scripts/000077500000000000000000000000001361473406400145405ustar00rootroot00000000000000sassphp-0.7/scripts/sassphp_install.sh000077500000000000000000000006371361473406400203140ustar00rootroot00000000000000#!/bin/sh echo Installing sassphp... cd vendor if [ ! -d sassphp ]; then git clone git://github.com/absalomedia/sassphp fi cd sassphp git pull git submodule init git submodule update php install.php make install echo Sassphp successfully installed. Remember to add extension=sass.so to your php.ini. Actual path may be different. Use: sudo find / -name sass.so | grep -v sassphpsassphp-0.7/src/000077500000000000000000000000001361473406400136405ustar00rootroot00000000000000sassphp-0.7/src/php_sass.h000066400000000000000000000030071361473406400156310ustar00rootroot00000000000000/** * Sass * PHP bindings to libsass - fast, native Sass parsing in PHP! * * https://github.com/absalomedia/sassphp * Copyright (c)2012 Jamie Rumbelow * Copyright (c)2017 Lawrence Meckan */ #ifndef PHP_SASS_H #define PHP_SASS_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #define SASS_VERSION "0.7" #define SASS_FLAVOR "Sassyphpras" #include #include #include #include #include #include zend_class_entry *sass_ce; zend_class_entry *sass_exception_ce; zend_class_entry *sass_get_exception_base(); #ifdef PHP_WIN32 #define PHP_SASS_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 #define PHP_SASS_API __attribute__((visibility("default"))) #else #define PHP_SASS_API #endif #ifdef ZTS #include "TSRM.h" #endif PHP_METHOD(Sass, __construct); PHP_METHOD(Sass, compile); PHP_METHOD(Sass, compileFile); PHP_METHOD(Sass, getStyle); PHP_METHOD(Sass, setStyle); PHP_METHOD(Sass, getIncludePath); PHP_METHOD(Sass, setIncludePath); PHP_METHOD(Sass, getPrecision); PHP_METHOD(Sass, setPrecision); PHP_METHOD(Sass, getComments); PHP_METHOD(Sass, setComments); PHP_METHOD(Sass, getIndent); PHP_METHOD(Sass, setIndent); PHP_METHOD(Sass, getEmbed); PHP_METHOD(Sass, setEmbed); PHP_METHOD(Sass, getMapPath); PHP_METHOD(Sass, setMapPath); PHP_METHOD(Sass, getMapRoot); PHP_METHOD(Sass, setMapRoot); PHP_METHOD(Sass, setImporter); PHP_METHOD(Sass, setFunctions); #endif sassphp-0.7/src/sass.c000066400000000000000000000632141361473406400147630ustar00rootroot00000000000000/** * Sass * PHP bindings to libsass - fast, native Sass parsing in PHP! * * https://github.com/jamierumbelow/sassphp * Copyright (c)2012 Jamie Rumbelow * * Fork updated and maintained by https://github.com/absalomedia */ #include #include #include "php_sass.h" #include "utilities.h" /* -------------------------------------------------------------- * Sass * ------------------------------------------------------------ */ zend_object_handlers sass_handlers; typedef struct sass_object { int style; char* include_paths; bool comments; bool indent; long precision; char* map_path; bool omit_map_url; bool map_embed; bool map_contents; char* map_root; zval importer; zval function_table; zend_object zo; } sass_object; zend_class_entry *sass_ce; static inline sass_object *sass_fetch_object(zend_object *obj) { return (sass_object *) ((char*) (obj) - XtOffsetOf(sass_object, zo)); } #define Z_SASS_P(zv) sass_fetch_object(Z_OBJ_P((zv))); static void sass_free_storage(zend_object *object) { sass_object *obj = sass_fetch_object(object); if (obj->include_paths != NULL) efree(obj->include_paths); if (obj->map_path != NULL) efree(obj->map_path); if (obj->map_root != NULL) efree(obj->map_root); zval_ptr_dtor(&obj->importer); zval_ptr_dtor(&obj->function_table); zend_object_std_dtor(object); } zend_object * sass_create_handler(zend_class_entry *type) { size_t size = sizeof(sass_object) + zend_object_properties_size(type); sass_object *obj = emalloc(size); memset(obj, 0, size - sizeof(zval)); zend_object_std_init(&obj->zo, type); object_properties_init(&obj->zo, type); obj->zo.handlers = &sass_handlers; return &obj->zo; } char *to_c_string(zval *var){ if (Z_TYPE_P(var) != IS_STRING) { convert_to_string(var); } return Z_STRVAL_P(var); } Sass_Import_Entry array_to_import(zval* val){ if (Z_TYPE_P(val) != IS_ARRAY){ return NULL; } int len = zend_hash_num_elements(Z_ARRVAL_P(val)); if (len < 1){ zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Need at least redirected path"); return NULL; } char *file = 0; zval *temp = zend_hash_index_find(Z_ARRVAL_P(val), 0); if (temp != NULL && !Z_ISUNDEF_P(temp) && Z_TYPE_P(temp) != IS_NULL){ file = sass_copy_c_string(to_c_string(temp)); } char *content = 0; temp = zend_hash_index_find(Z_ARRVAL_P(val), 1); if (temp != NULL && !Z_ISUNDEF_P(temp) && Z_TYPE_P(temp) != IS_NULL){ content = sass_copy_c_string(to_c_string(temp)); } char *map = 0; if (len >= 3){ temp = zend_hash_index_find(Z_ARRVAL_P(val), 2); if (temp != NULL && !Z_ISUNDEF_P(temp) && Z_TYPE_P(temp) != IS_NULL){ map = sass_copy_c_string(to_c_string(temp)); } } return sass_make_import_entry( file, content, map ); } Sass_Import_List sass_importer(const char* path, Sass_Importer_Entry cb, struct Sass_Compiler* comp){ sass_object *obj = (sass_object *) sass_importer_get_cookie(cb); if (obj == NULL){ zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Internal Error: Failed to retrieve object reference"); return NULL; } zval cb_args[1]; zval cb_retval; ZVAL_STRING(&cb_args[0], path); if (call_user_function_ex(EG(function_table), NULL, &obj->importer, &cb_retval, 1, cb_args, 0, NULL) != SUCCESS || Z_ISUNDEF(cb_retval)) { zval_ptr_dtor(&cb_args[0]); return NULL; } zval_ptr_dtor(&cb_args[0]); if (Z_TYPE(cb_retval) == IS_NULL){ zval_ptr_dtor(&cb_retval); return NULL; } if (Z_TYPE(cb_retval) != IS_ARRAY){ zval_ptr_dtor(&cb_retval); zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Importer callback must return an array"); return NULL; } int result_len = zend_hash_num_elements(Z_ARRVAL(cb_retval)); if (result_len < 1){ zval_ptr_dtor(&cb_retval); return NULL; } zval *first_element = zend_hash_index_find(Z_ARRVAL(cb_retval), 0); if (first_element == NULL){ zval_ptr_dtor(&cb_retval); zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Importer callback must return an array"); return NULL; } Sass_Import_List list; if (Z_TYPE_P(first_element) == IS_ARRAY){ list = sass_make_import_list(result_len); int idx = 0; zval *element; ZEND_HASH_FOREACH_VAL(Z_ARRVAL(cb_retval), element) { if (Z_TYPE_P(element) != IS_ARRAY){ zval_ptr_dtor(&cb_retval); zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Importer callback must return an array"); return NULL; } Sass_Import_Entry imp = array_to_import(element); if (imp == NULL) return NULL; list[idx] = imp; idx++; } ZEND_HASH_FOREACH_END(); }else{ list = sass_make_import_list(1); list[0] = array_to_import(&cb_retval); } zval_ptr_dtor(&cb_retval); return list; } union Sass_Value* sass_function(const union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Compiler* comp) { sass_object *obj = (sass_object *) sass_function_get_cookie(cb); if (obj == NULL){ zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Internal Error: Failed to retrieve object reference"); return NULL; } const char *signature = sass_function_get_signature(cb); if (Z_TYPE(obj->function_table) != IS_ARRAY){ zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Internal Error: Function table has vanished"); return NULL; } zend_string *fname = zend_string_init(signature, strlen(signature), 0); zval* callback = zend_hash_find(Z_ARRVAL(obj->function_table), fname); zend_string_release(fname); if (callback == NULL){ return sass_make_null(); } if (!zend_is_callable(callback, 0, NULL)) { zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Internal Error: value for sig %s lost its callbackyness", ZSTR_VAL(fname)); return sass_make_null(); } const char *string_value; // For now: Stringify all arguments. Later, we should probably marshal // this correctly and keep wrappers around native sass types. But for my // personal purpose, this is enough. if (!sass_value_is_string(s_args)){ string_value = sass_string_get_value(sass_value_stringify(s_args, false, obj->precision)); }else{ string_value = sass_string_get_value(s_args); } Sass_Import_Entry import = sass_compiler_get_last_import(comp); zval path_info; array_init(&path_info); add_assoc_string(&path_info, "absolute", (char*) sass_import_get_abs_path(import)); add_assoc_string(&path_info, "relative", (char*) sass_import_get_imp_path(import)); zval cb_args[2]; zval cb_retval; ZVAL_STRING(&cb_args[0], string_value); cb_args[1] = path_info; if (call_user_function_ex(EG(function_table), NULL, callback, &cb_retval, 2, cb_args, 0, NULL) != SUCCESS || Z_ISUNDEF(cb_retval)) { zval_ptr_dtor(&cb_args[0]); return sass_make_null(); } zval_ptr_dtor(&cb_args[0]); zval_ptr_dtor(&cb_args[1]); if (Z_TYPE_P(&cb_retval) != IS_STRING) { convert_to_string(&cb_retval); } union Sass_Value *r = sass_make_string(Z_STRVAL_P(&cb_retval)); zval_ptr_dtor(&cb_retval); return r; } PHP_METHOD(Sass, __construct) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_NULL(); } sass_object *obj = Z_SASS_P(this); obj->style = SASS_STYLE_NESTED; obj->include_paths = NULL; obj->map_path = NULL; obj->map_root = NULL; obj->comments = false; obj->indent = false; obj->map_embed = false; obj->map_contents = false; obj->omit_map_url = true; obj->precision = 5; ZVAL_UNDEF(&obj->importer); ZVAL_UNDEF(&obj->function_table); } void set_options(sass_object *this, struct Sass_Context *ctx) { struct Sass_Options* opts = sass_context_get_options(ctx); sass_option_set_precision(opts, this->precision); sass_option_set_output_style(opts, this->style); sass_option_set_is_indented_syntax_src(opts, this->indent); if (this->include_paths != NULL) { sass_option_set_include_path(opts, this->include_paths); } sass_option_set_source_comments(opts, this->comments); if (this->comments) { sass_option_set_omit_source_map_url(opts, false); } sass_option_set_source_map_embed(opts, this->map_embed); sass_option_set_source_map_contents(opts, this->map_contents); if (this->map_path != NULL) { sass_option_set_source_map_file(opts, this->map_path); sass_option_set_omit_source_map_url(opts, true); sass_option_set_source_map_contents(opts, false); } if (this->map_root != NULL) { sass_option_set_source_map_root(opts, this->map_root); } if (!Z_ISUNDEF(this->importer)) { Sass_Importer_Entry imp = sass_make_importer(sass_importer, 0, this); Sass_Importer_List imp_list = sass_make_importer_list(1); sass_importer_set_list_entry(imp_list, 0, imp); sass_option_set_c_importers(opts, imp_list); } if (!Z_ISUNDEF(this->function_table)) { int function_count = zend_hash_num_elements(Z_ARRVAL(this->function_table)); Sass_Function_List fn_list = sass_make_function_list(function_count); int idx = 0; zend_ulong num_key; zend_string *string_key; zval *val; Sass_Function_Entry fn; ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(this->function_table), num_key, string_key, val) { if (string_key == NULL){ zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Keys must be function declarations"); return; } if (!zend_is_callable(val, 0, NULL)) { zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Values must be callables, but value at `%s` isn't", ZSTR_VAL(string_key)); return; } fn = sass_make_function(ZSTR_VAL(string_key), sass_function, (void*)this); sass_function_set_list_entry(fn_list, idx, fn); idx++; } ZEND_HASH_FOREACH_END(); sass_option_set_c_functions(opts, fn_list); } } /** * $sass->parse(string $source, [ ]); * * Parse a string of Sass; a basic input -> output affair. */ PHP_METHOD(Sass, compile) { sass_object *this = sass_fetch_object(Z_OBJ_P(getThis())); // Define our parameters as local variables char *source, *input_path = NULL; size_t source_len, input_path_len = 0; // Use zend_parse_parameters() to grab our source from the function call if (zend_parse_parameters_throw(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &source, &source_len, &input_path, &input_path_len) == FAILURE){ RETURN_FALSE; } // Create a new sass_context struct Sass_Data_Context* data_context = sass_make_data_context(strdup(source)); struct Sass_Context* ctx = sass_data_context_get_context(data_context); set_options(this, ctx); if (input_path != NULL){ struct Sass_Options* opts = sass_context_get_options(ctx); sass_option_set_input_path(opts, input_path); } int status = sass_compile_data_context(data_context); // Check the context for any errors... if (status != 0) { zend_throw_exception(sass_exception_ce, sass_context_get_error_message(ctx), 0 TSRMLS_CC); } else { RETVAL_STRING(sass_context_get_output_string(ctx)); } sass_delete_data_context(data_context); } /** * $sass->parse_file(string $file_name); * * Parse a whole file FULL of Sass and return the CSS output */ PHP_METHOD(Sass, compileFile) { array_init(return_value); sass_object *this = Z_SASS_P(getThis()); // We need a file name and a length char *file; size_t file_len; // Grab the file name from the function if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) { RETURN_FALSE; } // First, do a little checking of our own. Does the file exist? if( access( file, F_OK ) == -1 ) { zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "File %s could not be found", file); RETURN_FALSE; } struct Sass_File_Context* file_ctx = sass_make_file_context(file); struct Sass_Context* ctx = sass_file_context_get_context(file_ctx); set_options(this, ctx); int status = sass_compile_file_context(file_ctx); // Check the context for any errors... if (status != 0) { zend_throw_exception(sass_exception_ce, sass_context_get_error_message(ctx), 0 TSRMLS_CC); } else { if (this->map_path != NULL ) { // Send it over to PHP. add_next_index_string(return_value, sass_context_get_output_string(ctx)); } else { RETVAL_STRING(sass_context_get_output_string(ctx)); } // Do we have source maps to go? if (this->map_path != NULL) { // Send it over to PHP. add_next_index_string(return_value, sass_context_get_source_map_string(ctx)); } } sass_delete_file_context(file_ctx); } PHP_METHOD(Sass, getStyle) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); RETURN_LONG(obj->style); } PHP_METHOD(Sass, setStyle) { zval *this = getThis(); long new_style; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_style) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); obj->style = new_style; RETURN_NULL(); } PHP_METHOD(Sass, getIncludePath) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); if (obj->include_paths == NULL) RETURN_STRING(""); RETURN_STRING(obj->include_paths); } PHP_METHOD(Sass, setIncludePath) { zval *this = getThis(); char *path; size_t path_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) RETURN_FALSE; sass_object *obj = Z_SASS_P(this); if (obj->include_paths != NULL) efree(obj->include_paths); obj->include_paths = estrndup(path, path_len); RETURN_NULL(); } PHP_METHOD(Sass, getMapPath) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); if (obj->map_path == NULL) RETURN_STRING(""); RETURN_STRING(obj->map_path); } PHP_METHOD(Sass, setMapPath) { zval *this = getThis(); char *path; size_t path_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) RETURN_FALSE; sass_object *obj = Z_SASS_P(this); if (obj->map_path != NULL) efree(obj->map_path); obj->map_path = estrndup(path, path_len); RETURN_NULL(); } PHP_METHOD(Sass, getMapRoot) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); if (obj->map_root == NULL) RETURN_STRING(""); RETURN_STRING(obj->map_root); } PHP_METHOD(Sass, setMapRoot) { zval *this = getThis(); char *path; size_t path_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) RETURN_FALSE; sass_object *obj = Z_SASS_P(this); if (obj->map_root != NULL) efree(obj->map_root); obj->map_root = estrndup(path, path_len); RETURN_NULL(); } PHP_METHOD(Sass, getPrecision) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); RETURN_LONG(obj->precision); } PHP_METHOD(Sass, setPrecision) { zval *this = getThis(); long new_precision; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_precision) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); obj->precision = new_precision; RETURN_NULL(); } PHP_METHOD(Sass, getEmbed) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); RETURN_LONG(obj->map_embed); } PHP_METHOD(Sass, setEmbed) { zval *this = getThis(); bool new_map_embed; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_map_embed) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); obj->map_embed = new_map_embed; RETURN_NULL(); } PHP_METHOD(Sass, getComments) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); RETURN_LONG(obj->comments); } PHP_METHOD(Sass, setComments) { zval *this = getThis(); bool new_comments; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_comments) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); obj->comments = new_comments; RETURN_NULL(); } PHP_METHOD(Sass, getIndent) { zval *this = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); RETURN_LONG(obj->indent); } PHP_METHOD(Sass, setIndent) { zval *this = getThis(); bool new_indent; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_indent) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(this); obj->indent = new_indent; RETURN_NULL(); } PHP_METHOD(Sass, setImporter) { zval *importer; zend_string *callback_name; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &importer) == FAILURE) { RETURN_FALSE; } sass_object *obj = Z_SASS_P(getThis()); if (Z_TYPE_P(importer) == IS_NULL){ if (!Z_ISUNDEF(obj->importer)) { zval_ptr_dtor(&obj->importer); } ZVAL_UNDEF(&obj->importer); RETURN_TRUE; } if (!zend_is_callable(importer, 0, &callback_name)) { php_error_docref(NULL, E_WARNING, "%s is not a valid callable", ZSTR_VAL(callback_name)); zend_string_release(callback_name); RETURN_FALSE; } if (!Z_ISUNDEF(obj->importer)) { zval_ptr_dtor(&obj->importer); ZVAL_UNDEF(&obj->importer); } ZVAL_COPY(&obj->importer, importer); RETURN_TRUE; } PHP_METHOD(Sass, setFunctions) { zval *funcs; if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "a!", &funcs) == FAILURE) { return; } sass_object *obj = Z_SASS_P(getThis()); if (funcs == NULL){ if (!Z_ISUNDEF(obj->function_table)) { zval_ptr_dtor(&obj->function_table); } ZVAL_UNDEF(&obj->function_table); RETURN_TRUE; } zend_ulong num_key; zend_string *string_key; zval *val; ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(funcs), num_key, string_key, val) { if (string_key == NULL){ zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Keys must be function declarations"); } if (!zend_is_callable(val, 0, NULL)) { zend_throw_exception_ex(sass_exception_ce, 0 TSRMLS_CC, "Values must be callables, but value at `%s` isn't", ZSTR_VAL(string_key)); RETURN_FALSE; } } ZEND_HASH_FOREACH_END(); if (!Z_ISUNDEF(obj->function_table)) { zval_ptr_dtor(&obj->function_table); ZVAL_UNDEF(&obj->function_table); } ZVAL_COPY(&obj->function_table, funcs); RETURN_TRUE; } PHP_METHOD(Sass, getLibraryVersion) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "", NULL) == FAILURE) { RETURN_FALSE; } RETURN_STRING(libsass_version()); } /* -------------------------------------------------------------- * EXCEPTION HANDLING * ------------------------------------------------------------ */ zend_class_entry *sass_get_exception_base(TSRMLS_D) { return zend_exception_get_default(TSRMLS_C); } /* -------------------------------------------------------------- * PHP EXTENSION INFRASTRUCTURE * ------------------------------------------------------------ */ ZEND_BEGIN_ARG_INFO(arginfo_sass_void, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_compile, 0, 0, 1) ZEND_ARG_INFO(0, sass_string) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_compileFile, 0, 0, 1) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setStyle, 0, 0, 1) ZEND_ARG_INFO(0, style) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setIncludePath, 0, 0, 1) ZEND_ARG_INFO(0, include_path) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setPrecision, 0, 0, 1) ZEND_ARG_INFO(0, precision) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setComments, 0, 0, 1) ZEND_ARG_INFO(0, comments) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setIndent, 0, 0, 1) ZEND_ARG_INFO(0, indent) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setEmbed, 0, 0, 1) ZEND_ARG_INFO(0, map_embed) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setMapPath, 0, 0, 1) ZEND_ARG_INFO(0, map_path) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setMapRoot, 0, 0, 1) ZEND_ARG_INFO(0, map_root) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setImporter, 0, 0, 1) ZEND_ARG_CALLABLE_INFO(0, importer, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_sass_setFunctions, 0, 0, 1) ZEND_ARG_ARRAY_INFO(0, function_table, 1) ZEND_END_ARG_INFO() zend_function_entry sass_methods[] = { PHP_ME(Sass, __construct, arginfo_sass_void, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) PHP_ME(Sass, compile, arginfo_sass_compile, ZEND_ACC_PUBLIC) PHP_ME(Sass, compileFile, arginfo_sass_compileFile, ZEND_ACC_PUBLIC) PHP_ME(Sass, getStyle, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setStyle, arginfo_sass_setStyle, ZEND_ACC_PUBLIC) PHP_ME(Sass, getIncludePath, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setIncludePath, arginfo_sass_setIncludePath, ZEND_ACC_PUBLIC) PHP_ME(Sass, getPrecision, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setPrecision, arginfo_sass_setPrecision, ZEND_ACC_PUBLIC) PHP_ME(Sass, getComments, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setComments, arginfo_sass_setComments, ZEND_ACC_PUBLIC) PHP_ME(Sass, getIndent, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setIndent, arginfo_sass_setIndent, ZEND_ACC_PUBLIC) PHP_ME(Sass, getEmbed, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setEmbed, arginfo_sass_setEmbed, ZEND_ACC_PUBLIC) PHP_ME(Sass, getMapPath, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setMapPath, arginfo_sass_setMapPath, ZEND_ACC_PUBLIC) PHP_ME(Sass, getMapRoot, arginfo_sass_void, ZEND_ACC_PUBLIC) PHP_ME(Sass, setMapRoot, arginfo_sass_setMapRoot, ZEND_ACC_PUBLIC) PHP_ME(Sass, setImporter, arginfo_sass_setImporter, ZEND_ACC_PUBLIC) PHP_ME(Sass, setFunctions, arginfo_sass_setFunctions, ZEND_ACC_PUBLIC) PHP_ME(Sass, getLibraryVersion, arginfo_sass_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_MALIAS(Sass, compile_file, compileFile, NULL, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; static PHP_MINIT_FUNCTION(sass) { zend_class_entry ce; zend_class_entry exception_ce; INIT_CLASS_ENTRY(ce, "Sass", sass_methods); sass_ce = zend_register_internal_class(&ce TSRMLS_CC); sass_ce->create_object = sass_create_handler; memcpy(&sass_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); sass_handlers.offset = XtOffsetOf(struct sass_object, zo); sass_handlers.free_obj = sass_free_storage; sass_handlers.clone_obj = NULL; INIT_CLASS_ENTRY(exception_ce, "SassException", NULL); sass_exception_ce = zend_register_internal_class_ex(&exception_ce, sass_get_exception_base(TSRMLS_C)); #define REGISTER_SASS_CLASS_CONST_LONG(name, value) zend_declare_class_constant_long(sass_ce, ZEND_STRS( #name ) - 1, value TSRMLS_CC) REGISTER_SASS_CLASS_CONST_LONG(STYLE_NESTED, SASS_STYLE_NESTED); REGISTER_SASS_CLASS_CONST_LONG(STYLE_EXPANDED, SASS_STYLE_EXPANDED); REGISTER_SASS_CLASS_CONST_LONG(STYLE_COMPACT, SASS_STYLE_COMPACT); REGISTER_SASS_CLASS_CONST_LONG(STYLE_COMPRESSED, SASS_STYLE_COMPRESSED); REGISTER_STRING_CONSTANT("SASS_FLAVOR", SASS_FLAVOR, CONST_CS | CONST_PERSISTENT); return SUCCESS; } static PHP_MINFO_FUNCTION(sass) { php_info_print_table_start(); php_info_print_table_row(2, "sass support", "enabled"); php_info_print_table_row(2, "version", SASS_VERSION); php_info_print_table_row(2, "flavor", SASS_FLAVOR); php_info_print_table_row(2, "libsass version", libsass_version()); php_info_print_table_end(); } static zend_module_entry sass_module_entry = { STANDARD_MODULE_HEADER, "sass", NULL, PHP_MINIT(sass), NULL, NULL, NULL, PHP_MINFO(sass), SASS_VERSION, STANDARD_MODULE_PROPERTIES }; #ifdef COMPILE_DL_SASS ZEND_GET_MODULE(sass) #endif sassphp-0.7/src/utilities.c000066400000000000000000000007731361473406400160260ustar00rootroot00000000000000/** * Sass * PHP bindings to libsass - fast, native Sass parsing in PHP! * * https://github.com/jamierumbelow/sassphp * Copyright (c)2012 Jamie Rumbelow */ #include #include #include "utilities.h" /** * A C implementation of PHP's trim() */ char *trim(char *str) { char *end; while(isspace(*str)) str++; if(*str == 0) { return str; } end = str + strlen(str) - 1; while(end > str && isspace(*end)) end--; *(end+1) = 0; return str; }sassphp-0.7/src/utilities.h000066400000000000000000000004231361473406400160230ustar00rootroot00000000000000/** * Sass * PHP bindings to libsass - fast, native Sass parsing in PHP! * * https://github.com/jamierumbelow/sassphp * Copyright (c)2012 Jamie Rumbelow * * Fork updated and maintained by https://github.com/pilif */ char *trim(char *str); sassphp-0.7/stubs/000077500000000000000000000000001361473406400142115ustar00rootroot00000000000000sassphp-0.7/stubs/sass.php000066400000000000000000000073501361473406400157000ustar00rootroot00000000000000 and Lawrence Meckan * * @link https://github.com/absalomedia/sassphp */ class Sass { /** * 'Nested' format. * */ const STYLE_NESTED = 0; /** * 'Expanded' format. */ const STYLE_EXPANDED = 1; /** * 'Compact' format. */ const STYLE_COMPACT = 2; /** * 'Compressed' format. */ const STYLE_COMPRESSED = 3; /** * Constructor SASS. */ public function __construct() { } /** * Compile string. * * @param string $string input SASS string * * @throws SassException if compilation failed * * @return string output CSS */ public function compile($string) { } /** * Compile file. * * @param string $filename input filename * * @throws SassException if compilation failed or invalid arguments given * * @return string|string[] */ public function compileFile($filename) { } /** * Set style. * * @param int $style * * @return void */ public function setStyle($style) { } /** * Get style. * * @return int */ public function getStyle() { } /** * Set include path. * * @param string $path input directory * * @return void */ public function setIncludePath($path) { } /** * Get include path. * * @return string */ public function getIncludePath() { } /** * Set precision. * * @param int $precision * * @return void */ public function setPrecision($precision) { } /** * Get precision. * * @return int */ public function getPrecision() { } /** * Set CSS comments. * * @param bool $comments * * @return void */ public function setComments($comments) { } /** * Enable CSS comments. * * @return bool */ public function getComments() { } /** * Set style indent. * * @param bool $indent * * @return void */ public function setIndent($indent) { } /** * Is style indent (SASS or SCSS). * * @return bool */ public function getIndent() { } /** * Set map embed. * * @param bool $embed * * @return void */ public function setEmbed($embed) { } /** * Is map embed. * * @return bool */ public function getEmbed() { } /** * Set map path. * * @param string $map input path * * @return void */ public function setMapPath($map) { } /** * Get map path. * * @return string */ public function getMapPath() { } /** * Set map root. * * @param string $root input root * * @return void */ public function setMapRoot($root) { } /** * Get map root. * * @return string */ public function getMapRoot() { } /** * Set LibSass importer. * * @param string|string[] $import * * @return void */ public function setImporter($import) { } /** * Set LibSass functions. * * @param string|string[] $function * * @return void */ public function setFunctions($function) { } /** * Get LibSass library version. * * @return string */ public function getLibraryVersion() { } } /** * Runtime compilation error. */ class SassException extends Exception { } sassphp-0.7/tests/000077500000000000000000000000001361473406400142135ustar00rootroot00000000000000sassphp-0.7/tests/arginfo_present.phpt000066400000000000000000000007151361473406400203000ustar00rootroot00000000000000--TEST-- Making sure ARG_INFO is present --SKIPIF-- --FILE-- getMethod("setIncludePath"); $params = $m->getParameters(); echo $params[0]."\n"; $m = $c->getMethod("setStyle"); $params = $m->getParameters(); echo $params[0]."\n"; ?> --EXPECT-- Parameter #0 [ $include_path ] Parameter #0 [ $style ] sassphp-0.7/tests/available.phpt000066400000000000000000000002771361473406400170360ustar00rootroot00000000000000--TEST-- Check for sass presence --SKIPIF-- --FILE-- --EXPECT-- sass extension is availablesassphp-0.7/tests/check_bundled_libsass_version.phpt000066400000000000000000000003021361473406400231420ustar00rootroot00000000000000--TEST-- check bundled libsass version --SKIPIF-- --FILE-- --EXPECT-- 0 sassphp-0.7/tests/class_exists.phpt000066400000000000000000000003071361473406400176140ustar00rootroot00000000000000--TEST-- Test Sass is a class --SKIPIF-- --FILE-- --EXPECT-- Sass class existssassphp-0.7/tests/class_instantiatable.phpt000066400000000000000000000003041361473406400212740ustar00rootroot00000000000000--TEST-- Test Sass is instantiatable --SKIPIF-- --FILE-- --EXPECT-- Sasssassphp-0.7/tests/custom_function.phpt000066400000000000000000000010111361473406400203200ustar00rootroot00000000000000--TEST-- custom importer: external file --SKIPIF-- --FILE-- setFunctions([ 'a($a)' => function($in, $path_info){ echo $in; return "hello $in"; }, 'b($a)' => function($in, $path_info){ echo $in; return "goodbye $in"; }, ]); echo $sass->compile('body { content: a("foo"); } h1 { content: b("bar"); }'); ?> --EXPECT-- foobarbody { content: hello foo; } h1 { content: goodbye bar; } sassphp-0.7/tests/custom_importer_compiled_output.phpt000066400000000000000000000005041361473406400236360ustar00rootroot00000000000000--TEST-- custom importer: external file --SKIPIF-- --FILE-- setImporter(function($in){ echo "$in\n"; return [null, '.foo { color: red;}']; }); echo $sass->compile('@import "flupp";'); ?> --EXPECT-- flupp .foo { color: red; } sassphp-0.7/tests/custom_importer_external_file.phpt000066400000000000000000000005041361473406400232430ustar00rootroot00000000000000--TEST-- custom importer: external file --SKIPIF-- --FILE-- setImporter(function($in){ echo "$in\n"; return [__DIR__.'/support/foo.scss']; }); echo $sass->compile('@import "flupp";'); ?> --EXPECT-- flupp h2 { color: green; } sassphp-0.7/tests/file_comments.phpt000066400000000000000000000007151361473406400177370ustar00rootroot00000000000000--TEST-- compiles correct Sass file and provides source comments --SKIPIF-- --FILE-- setComments(true); $css = $sass->compileFile(__DIR__.'/support/test.scss'); echo $css; ?> --EXPECTF-- @import url(../blahblah/blah.blah); /* line 3, %s/support/test.scss */ div { blah: "hello 4 world px bloo blah"; } /* line 9, %s/support/test.scss */ div { blah: "foo iphone"; } sassphp-0.7/tests/file_embed.phpt000066400000000000000000000014021361473406400171600ustar00rootroot00000000000000--TEST-- compiles correct Sass file and provides source embedding --SKIPIF-- --FILE-- setEmbed(true); $css = $sass->compileFile(__DIR__.'/support/test.scss'); echo $css; ?> --EXPECT-- @import url(../blahblah/blah.blah); div { blah: "hello 4 world px bloo blah"; } div { blah: "foo iphone"; } /*# sourceMappingURL=data:application/json;base64,ewoJInZlcnNpb24iOiAzLAoJImZpbGUiOiAidGVzdHMvc3VwcG9ydC90ZXN0LmNzcyIsCgkic291cmNlcyI6IFsKCQkidGVzdHMvc3VwcG9ydC90ZXN0LnNjc3MiCgldLAoJIm5hbWVzIjogW10sCgkibWFwcGluZ3MiOiAiQUFBQSxPQUFPLENBQUMsMEJBQUk7QUFFWixBQUFBLEdBQUcsQ0FBQztFQUNGLElBQUksRUFBRSw0QkFBaUQsR0FDeEQ7O0FBSUQsQUFBQSxHQUFHLENBQUM7RUFDQSxJQUFJLEVBQUUsWUFBYSxHQUN0QiIKfQ== */ sassphp-0.7/tests/file_indent.phpt000066400000000000000000000005201361473406400173650ustar00rootroot00000000000000--TEST-- compiles SASS file in comparison to SCSS based SASS file --SKIPIF-- --FILE-- setIndent(true); $css = $sass->compileFile(__DIR__.'/support/source_type.sass'); echo $css; ?> --EXPECT-- body { background: red; border: 1px solid green; }sassphp-0.7/tests/get_map_path.phpt000066400000000000000000000004311361473406400175360ustar00rootroot00000000000000--TEST-- correctly handles getting source map path --SKIPIF-- --FILE-- setMapPath('map_path.css.map'); echo $sass->getMapPath(); ?> --EXPECT-- map_path.css.mapsassphp-0.7/tests/get_map_root.phpt000066400000000000000000000004141361473406400175660ustar00rootroot00000000000000--TEST-- correctly handles getting source map root --SKIPIF-- --FILE-- setMapRoot('/sources/'); echo $sass->getMapRoot(); ?> --EXPECT-- /sources/ sassphp-0.7/tests/handles_comments.phpt000066400000000000000000000006171361473406400204370ustar00rootroot00000000000000--TEST-- correctly handles setting and getting comments --SKIPIF-- --FILE-- getComments(); // test SASS_SOURCE_NONE $sass->setComments(false); echo $sass->getComments(); // test SASS_SOURCE_DEFAULT $sass->setComments(true); echo $sass->getComments(); ?> --EXPECT-- 001 sassphp-0.7/tests/handles_embed.phpt000066400000000000000000000006101361473406400176570ustar00rootroot00000000000000--TEST-- correctly handles setting and getting source embedding --SKIPIF-- --FILE-- getEmbed(); // test SASS_SOURCE_NONE $sass->setEmbed(false); echo $sass->getEmbed(); // test SASS_SOURCE_DEFAULT $sass->setEmbed(true); echo $sass->getEmbed(); ?> --EXPECT-- 001 sassphp-0.7/tests/handles_include_path.phpt000066400000000000000000000005721361473406400212510ustar00rootroot00000000000000--TEST-- correctly handles includePath --SKIPIF-- --FILE-- setIncludePath(__DIR__.'/support'); $css = $sass->compile(' @import "foo"; '); echo $css; echo $sass->compileFile(__DIR__.'/support/import.scss'); ?> --EXPECT-- h2 { color: green; } h2 { color: green; } h1 { color: red; } sassphp-0.7/tests/handles_indent.phpt000066400000000000000000000005721361473406400200730ustar00rootroot00000000000000--TEST-- correctly handles setting and getting SCSS / SASS file indents --SKIPIF-- --FILE-- getIndent(); // test SCSS $sass->setIndent(false); echo $sass->getIndent(); // test SASS $sass->setIndent(true); echo $sass->getIndent(); ?> --EXPECT-- 001 sassphp-0.7/tests/handles_map.phpt000066400000000000000000000011071361473406400173620ustar00rootroot00000000000000--TEST-- correctly handles setting and getting source map formats --SKIPIF-- --FILE-- setComments(true); $sass->setMapPath(__DIR__.'/support/test.css.map'); $css = $sass->compileFile(__DIR__.'/support/test.scss'); echo $css[1]; ?> --EXPECT-- { "version": 3, "file": "test.css", "sources": [ "test.scss" ], "names": [], "mappings": "AAAA,OAAO,CAAC,0BAAI;;AAEZ,AAAA,GAAG,CAAC;EACF,IAAI,EAAE,4BAAiD,GACxD;;;AAID,AAAA,GAAG,CAAC;EACA,IAAI,EAAE,YAAa,GACtB" } sassphp-0.7/tests/handles_map_root.phpt000066400000000000000000000011671361473406400204330ustar00rootroot00000000000000--TEST-- correctly handles setting map root --SKIPIF-- --FILE-- setComments(true); $sass->setMapRoot('support'); $sass->setMapPath('map_root.css.map'); $css = $sass->compileFile(__DIR__.'/support/test.scss'); echo $css[1]; ?> --EXPECT-- { "version": 3, "file": "tests/support/test.css", "sourceRoot": "support", "sources": [ "tests/support/test.scss" ], "names": [], "mappings": "AAAA,OAAO,CAAC,0BAAI;;AAEZ,AAAA,GAAG,CAAC;EACF,IAAI,EAAE,4BAAiD,GACxD;;;AAID,AAAA,GAAG,CAAC;EACA,IAAI,EAAE,YAAa,GACtB" } sassphp-0.7/tests/handles_precision.phpt000066400000000000000000000013611361473406400206020ustar00rootroot00000000000000--TEST-- correctly handles setting and getting precision --SKIPIF-- --FILE-- getPrecision() . "\n"; // compile with above precision echo $sass->compile($scss); // set to "large" number $sass->setPrecision(10); echo $sass->getPrecision() . "\n"; // compile with above precision echo $sass->compile($scss); // set to "small" number $sass->setPrecision(1); echo $sass->getPrecision() . "\n"; // compile with above precision echo $sass->compile($scss); ?> --EXPECT-- 5 body { width: 33.33333%; } 10 body { width: 33.3333333333%; } 1 body { width: 33.3%; } sassphp-0.7/tests/handles_style.phpt000066400000000000000000000011311361473406400177420ustar00rootroot00000000000000--TEST-- correctly handles setting and getting style --SKIPIF-- --FILE-- getStyle(); // test SASS_OUTPUT_NESTED $sass->setStyle(Sass::STYLE_NESTED); echo $sass->getStyle(); // test SASS_OUTPUT_EXPANDED $sass->setStyle(Sass::STYLE_EXPANDED); echo $sass->getStyle(); // test SASS_OUTPUT_COMPACT $sass->setStyle(Sass::STYLE_COMPACT); echo $sass->getStyle(); // test SASS_OUTPUT_COMPRESSED $sass->setStyle(Sass::STYLE_COMPRESSED); echo $sass->getStyle(); ?> --EXPECT-- 00123sassphp-0.7/tests/old_compile_file_alias_exists.phpt000066400000000000000000000005201361473406400231420ustar00rootroot00000000000000--TEST-- old compile_file() alias exists --SKIPIF-- --FILE-- compile_file('tests/support/test.scss'); echo $css; ?> --EXPECT-- @import url(../blahblah/blah.blah); div { blah: "hello 4 world px bloo blah"; } div { blah: "foo iphone"; } sassphp-0.7/tests/output_path_with_memory_compile.phpt000066400000000000000000000004221361473406400236150ustar00rootroot00000000000000--TEST-- set output_path when compiling in memory --SKIPIF-- --FILE-- compile('@import "subsub/a.scss";', __DIR__.'/support/sub/a.scss'); ?> --EXPECT-- body { background: red; } sassphp-0.7/tests/parse_file_parses_file.phpt000066400000000000000000000005231361473406400215750ustar00rootroot00000000000000--TEST-- compileFile() compiles correct file --SKIPIF-- --FILE-- compileFile('tests/support/test.scss'); echo $css; ?> --EXPECT-- @import url(../blahblah/blah.blah); div { blah: "hello 4 world px bloo blah"; } div { blah: "foo iphone"; } sassphp-0.7/tests/parse_parses_correct_sass.phpt000066400000000000000000000007431361473406400223550ustar00rootroot00000000000000--TEST-- parse() parses correct Sass --SKIPIF-- --FILE-- compile(' table.hl { margin: 2em 0; td.ln { text-align: right; } } li { font: { family: serif; weight: bold; size: 1.2em; } } '); echo $css; ?> --EXPECT-- table.hl { margin: 2em 0; } table.hl td.ln { text-align: right; } li { font-family: serif; font-weight: bold; font-size: 1.2em; } sassphp-0.7/tests/support/000077500000000000000000000000001361473406400157275ustar00rootroot00000000000000sassphp-0.7/tests/support/foo.scss000066400000000000000000000000311361473406400174010ustar00rootroot00000000000000h2 { color: green; } sassphp-0.7/tests/support/huge.css.map000066400000000000000000000044341361473406400201520ustar00rootroot00000000000000{ "version": 3, "file": "huge.css", "sources": [ "huge.scss" ], "names": [], "mappings": ";AAGA,AAAA,GAAG,CAAC;EACF,KAAK,EAAE,GAAG;EACV,KAAK,EAAE,IAAI,GAkFZ;;EApFD,AAME,GANC,CAMD,GAAG,CAAC;IACF,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,IAAI,GA2EZ;;IAnFH,AASI,GATD,CAMD,GAAG,CAGD,CAAC,CAAC;MACA,MAAM,EAPH,CAAC,CAAC,CAAC,CAAC,CAAC;MASR,OAAO,EAAE,QAAQ;MAMjB,GAAG,EAdA,OAAO,GA8EX;;MAlFL,AAaM,GAbH,CAMD,GAAG,CAGD,CAAC,CAIC,CAAC,CAAC;QACA,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,GAAG;QACZ,KAAK,EALA,OAAO,GAMb;;MAjBP,AAoBQ,GApBL,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAAC;QACR,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,cAAc,GA0DvB;;QAhFT,AAuBU,GAvBP,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAGP,IAAI,CAAC;UACH,OAAO,EAAE,KAAK;UACd,kBAAkB,EAAE,UAAU,GAC/B;;QA1BX,AA8BU,GA9BP,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAAC;UACF,KAAK,EAAE,GAAG;UACV,KAAK,EAAE,IAAI,GA+CZ;;UA/EX,AAiCY,GAjCT,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAGD,CAAC,CAAC;YACA,MAAM,EAPH,CAAC,CAAC,CAAC,CAAC,CAAC;YASR,OAAO,EAAE,QAAQ;YAMjB,GAAG,EAdA,OAAO,GAyBX;;YArDb,AAqCc,GArCX,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAGD,CAAC,CAIC,CAAC,CAAC;cACA,OAAO,EAAE,YAAY;cACrB,OAAO,EAAE,GAAG;cACZ,KAAK,EALA,OAAO,GAMb;;YAzCf,AA4CgB,GA5Cb,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAAC;cACR,UAAU,EAAE,SAAS;cACrB,MAAM,EAAE,cAAc,GAKvB;;cAnDjB,AA+CkB,GA/Cf,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAGP,IAAI,CAAC;gBACH,OAAO,EAAE,KAAK;gBACd,kBAAkB,EAAE,UAAU,GAC/B;;UAlDnB,AAsDY,GAtDT,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAwBD,GAAG,CAAC;YACF,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,IAAI,GAsBZ;;YA9Eb,AAyDc,GAzDX,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAwBD,GAAG,CAGD,CAAC,CAAC;cACA,MAAM,EA/BL,CAAC,CAAC,CAAC,CAAC,CAAC;cAiCN,OAAO,EAAE,QAAQ;cAMjB,GAAG,EAtCF,OAAO,GAiDT;;cA7Ef,AA6DgB,GA7Db,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAwBD,GAAG,CAGD,CAAC,CAIC,CAAC,CAAC;gBACA,OAAO,EAAE,YAAY;gBACrB,OAAO,EAAE,GAAG;gBACZ,KAAK,EALA,OAAO,GAMb;;cAjEjB,AAoEkB,GApEf,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAwBD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAAC;gBACR,UAAU,EAAE,SAAS;gBACrB,MAAM,EAAE,cAAc,GAKvB;;gBA3EnB,AAuEoB,GAvEjB,CAMD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAUP,GAAG,CAwBD,GAAG,CAGD,CAAC,CAUC,KAAK,CACH,SAAS,CAGP,IAAI,CAAC;kBACH,OAAO,EAAE,KAAK;kBACd,kBAAkB,EAAE,UAAU,GAC/B" }sassphp-0.7/tests/support/huge.scss000066400000000000000000000036721361473406400175640ustar00rootroot00000000000000$blah: a b c; $bloo: "hello"; div { color: red; width: 100%; $blah: a b c; $bloo: "hello"; div { color: red; width: 100%; p { margin: $blah; $blee: goodbye; padding: 10px 5px; a { display: inline-block; padding: 5px; color: $blee; } foo: $bloo; empty { not-empty { background: lightgray; border: 1px solid blue; span { display: block; -webkit-box-sizing: border-box; } $blah: a b c; $bloo: "hello"; div { color: red; width: 100%; p { margin: $blah; $blee: goodbye; padding: 10px 5px; a { display: inline-block; padding: 5px; color: $blee; } foo: $bloo; empty { not-empty { background: lightgray; border: 1px solid blue; span { display: block; -webkit-box-sizing: border-box; } } } } div { color: red; width: 100%; p { margin: $blah; $blee: goodbye; padding: 10px 5px; a { display: inline-block; padding: 5px; color: $blee; } foo: $bloo; empty { not-empty { background: lightgray; border: 1px solid blue; span { display: block; -webkit-box-sizing: border-box; } } } } } } } } } } } sassphp-0.7/tests/support/import.scss000066400000000000000000000000461361473406400201360ustar00rootroot00000000000000@import 'foo'; h1 { color: red; } sassphp-0.7/tests/support/source_type.sass000066400000000000000000000001521361473406400211610ustar00rootroot00000000000000$color: red =my-border($color) border: 1px solid $color body background: $color +my-border(green) sassphp-0.7/tests/support/sub/000077500000000000000000000000001361473406400165205ustar00rootroot00000000000000sassphp-0.7/tests/support/sub/subsub/000077500000000000000000000000001361473406400200235ustar00rootroot00000000000000sassphp-0.7/tests/support/sub/subsub/a.scss000066400000000000000000000000361361473406400211370ustar00rootroot00000000000000body { background: red; } sassphp-0.7/tests/support/test.scss000066400000000000000000000002301361473406400175760ustar00rootroot00000000000000@import url(../blahblah/blah.blah); div { blah: "hello #{2+2} world #{unit(23px)} #{'bloo'} blah"; } $foo: iphone; div { blah: "foo #{$foo}" } sassphp-0.7/tests/throw_exception.phpt000066400000000000000000000004621361473406400203330ustar00rootroot00000000000000--TEST-- If there's an error while parsing, throw a SassException --SKIPIF-- --FILE-- compile('askdgauwydv7iq2dq'); } catch (SassException $e) { echo 'Exception caught'; } ?> --EXPECT-- Exception caught