Code Monkey home page Code Monkey logo

sass-rs's Introduction

sass-rs

Build Status Windows build status Maintenance status

Api documentation on docs.rs

--

This crate is not maintained anymore as libsass is deprecated. Consider using https://github.com/connorskees/grass or https://github.com/kaj/rsass instead.

--

This crate is a wrapper around libsass, currently tracking v3.6.4.

To build this crate on Windows, you will need to have Visual Studio installed.

You can control the number of CPU used to build libsass by setting the MAKE_LIBSASS_JOBS variable to the desired value. It defaults to the number of CPUs in the machine.

Binary

This package also provides a small binary that can be cargo installed to convert Sass files and print the output CSS. Example usage:

$ sass-rs < source/style.scss  # for SCSS
$ sass-rs --sass < source/style.sass  # for SASS
$ sass-rs --sass --expanded < source/style.sass
$ sass-rs --sass --compact < source/style.sass
$ sass-rs --sass --compressed < source/style.sass
$ sass-rs --sass --compressed < source/style.sass > build/style.css

This is a small added feature that isn't meant to fulfill every usecases. If you want to have something added to the binary, do a PR as I will not implement it myself.

Not supported yet

Importers and functions are not supported yet.

Building (Windows)

Windows compilation using VS 2019 requires that all the environment variables for MSBuild to be availble.

An indicator that the environment is not properly setup is the following error message:

error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

If you find this error, you have a couple of of options to select:

  • [Easiest] Open the Developer Command Prompt for VS 2019 application to compile the project. This terminal will setup all the needed environment variables to let it compile.
  • Setup the environment variables (eg: PATH, LIB) as documented on Microsoft's website
  • Install the complete setup of Visual Studio 2015 - not only the Visual C++ Build tools

sass-rs's People

Contributors

austinwise avatar bltavares avatar dashaw92 avatar dusterthefirst avatar fneddy avatar freaky avatar gchp avatar greizgh avatar ignatenkobrain avatar im-n1 avatar kaj avatar keats avatar kornelski avatar mcgoo avatar mneumann avatar mozamimy avatar nemo157 avatar onur avatar tckmn avatar traviscross avatar winding-lines avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sass-rs's Issues

Return `EXIT_FAILURE` on errors

It would be nice when the 'sass-rs' binary fails with an error code when it can not parse the input file. This would allow to use this binary in scripts or makefiles.

Something like

fn main() -> Result<(), String> {
    /* ... */
    compile_string(buffer.as_str(), opts).and_then(|v| println!("{}", v)).map(|_| ())
}

Still active?

Hi guys,

just wanted to know whether this project is still being actively maintained by you. Otherwise I'd probably think of forking and maintaining it myself.

Cheers,
Manuel

Failed to build under WSL

error: failed to run custom build command for `sass-sys v0.4.21`

Caused by:
  process didn't exit successfully: `/mnt/c/Users/leo/source/repos/leotsarev/zola/target/debug/build/sass-sys-9d68eb7e929d851e/build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at '
  fs::copy(path, dst) failed with Operation not permitted (os error 1)
  ', /home/leotsarev/.cargo/registry/src/github.com-1ecc6299db9ec823/sass-sys-0.4.21/build.rs:46:13
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
     1: std::panicking::begin_panic_fmt
               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
     2: build_script_build::cp_r
               at ./build.rs:46
     3: build_script_build::compile
               at ./build.rs:92
     4: build_script_build::main
               at ./build.rs:218
     5: core::ops::function::FnOnce::call_once
               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/ops/function.rs:227
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed

error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.

I'm on Windows 10, and am getting this:

error: failed to run custom build command for `sass-sys v0.4.7`
process didn't exit successfully: `C:\Users\steve\src\wubwub\target\debug\build\sass-sys-8b457a76a1cfface\build-script-build` (exit code: 101)
--- stdout
Upgrade error:
STDERR:
STDOUT:

--- stderr
thread 'main' panicked at 'Build error:
STDERR:
STDOUT:Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 12/5/2018 11:49:45 AM.
Project "C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Win64".
Project "C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.sln" (1) is building "C:\Users\steve\src\wubwub\
target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.vcxproj" (2) on node 1 (default targets).
GitVersion:
  git -C .. describe --abbrev=4 --dirty --always --tags
  cc63
Main:
  libsass: cc63
  Building Static LibSass
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(65,5): error MSB8020: The build
tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build
 tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecti
ng "Retarget solution". [C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.vcxproj]
Done Building Project "C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.vcxproj" (default targets) -- FAIL
ED.
Done Building Project "C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.sln" (default targets) -- FAILED.

Build FAILED.

"C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.sln" (default target) (1) ->
"C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.vcxproj" (default target) (2) ->
(PlatformPrepareForBuild target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(65,5): error MSB8020: The buil
d tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 bui
ld tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selec
ting "Retarget solution". [C:\Users\steve\src\wubwub\target\debug\build\sass-sys-aca8006281f33b2a\out\build\win\libsass.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.95
', C:\Users\steve\.cargo\registry\src\github.com-1ecc6299db9ec823\sass-sys-0.4.7\build.rs:144:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

I don't understand why it's looking for VS2010; I have VS 2017 installed, and your tests are passing on appveyor. any ideas?

Improve build speed on Windows

It takes 5-10x on Windows (2017) than on Linux/OSX, it might be a matter of parallelizing more or some msbuild option?

location override for system-provided libsass

Hi, your libsass crate got pulled in in my work while packaging zola for pkgsrc.

Are you open to add an option to use a system provided, already compiled, libsass? This would make it a bit easier for the packaging.

published [email protected] fails to build and link against native library

Example:

> cargo download -x sass-sys
INFO: cargo-download v0.1.2
INFO: Latest version of crate sass-sys=* is 0.4.20
INFO: Crate `sass-sys==0.4.20` downloaded successfully
INFO: Crate content extracted to ./sass-sys-0.4.20/

> cd sass-sys-0.4.20

> cargo build -vv
[...]
   Compiling sass-sys v0.4.20 (/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20)
     Running `CARGO=/home/nemo157/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_MANIFEST_DIR=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20 CARGO_PKG_AUTHORS='Marius Seritan <[email protected]>:Vincent Prouillet <[email protected]>' CARGO_PKG_DESCRIPTION='Low level binding for the Sass library' CARGO_PKG_HOMEPAGE='https://github.com/compass-rs/sass-rs' CARGO_PKG_NAME=sass-sys CARGO_PKG_REPOSITORY='https://github.com/compass-rs/sass-rs.git' CARGO_PKG_VERSION=0.4.20 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=4 CARGO_PKG_VERSION_PATCH=20 CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps:/home/nemo157/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/nemo157/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib' rustc --crate-name build_script_build build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=381602533f1d4ffa -C extra-filename=-381602533f1d4ffa --out-dir /tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/build/sass-sys-381602533f1d4ffa -C incremental=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/incremental -L dependency=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps --extern num_cpus=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps/libnum_cpus-1ad81d08984cdbab.rlib --extern pkg_config=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps/libpkg_config-024e3ab7d35f04aa.rlib`
     Running `/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/build/sass-sys-381602533f1d4ffa/build-script-build`
[sass-sys 0.4.20] fatal: not a git repository (or any parent up to mount point /)
[sass-sys 0.4.20] Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
     Running `CARGO=/home/nemo157/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_MANIFEST_DIR=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20 CARGO_PKG_AUTHORS='Marius Seritan <[email protected]>:Vincent Prouillet <[email protected]>' CARGO_PKG_DESCRIPTION='Low level binding for the Sass library' CARGO_PKG_HOMEPAGE='https://github.com/compass-rs/sass-rs' CARGO_PKG_NAME=sass-sys CARGO_PKG_REPOSITORY='https://github.com/compass-rs/sass-rs.git' CARGO_PKG_VERSION=0.4.20 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=4 CARGO_PKG_VERSION_PATCH=20 CARGO_PKG_VERSION_PRE= LD_LIBRARY_PATH='/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps:/home/nemo157/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/nemo157/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib' OUT_DIR=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/build/sass-sys-855fe86c8e567e15/out rustc --crate-name sass_sys src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=786030e66d118754 -C extra-filename=-786030e66d118754 --out-dir /tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps -C incremental=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/incremental -L dependency=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps --extern libc=/tmp/tmp.kVOrWJwYdA/sass-sys-0.4.20/target/debug/deps/liblibc-168e700d4fe57208.rmeta`
    Finished dev [unoptimized + debuginfo] target(s) in 1.37s

> tree target/debug/build/sass-sys*
target/debug/build/sass-sys-381602533f1d4ffa
โ”œโ”€โ”€ build-script-build
โ”œโ”€โ”€ build_script_build-381602533f1d4ffa
โ””โ”€โ”€ build_script_build-381602533f1d4ffa.d
target/debug/build/sass-sys-855fe86c8e567e15
โ”œโ”€โ”€ invoked.timestamp
โ”œโ”€โ”€ out
โ”œโ”€โ”€ output
โ”œโ”€โ”€ root-output
โ””โ”€โ”€ stderr

1 directory, 7 files

The .git directory is (correctly) not published as part of the package, so the build script returns at

if !Path::new("libsass/.git").exists() {

This means there is no native library built in the OUT_DIR, and the rustc-link-{search,lib} commands are not output, so the compiler does not attempt to link against it, resulting in errors when building applications like

          /usr/bin/ld: /home/nemo157/sources/docs.rs/target/debug/deps/libsass_rs-14c2270bd1f1822c.rlib(sass_rs-14c2270bd1f1822c.sass_rs.5hp5sijh-cgu.7.rcgu.o): in function `<sass_rs::bindings::context::Context as core::ops::drop::Drop>::drop':
          /home/nemo157/.cargo/registry/src/github.com-1ecc6299db9ec823/sass-rs-0.2.2/src/bindings/context.rs:143: undefined reference to `sass_delete_file_context'
          /usr/bin/ld: /home/nemo157/.cargo/registry/src/github.com-1ecc6299db9ec823/sass-rs-0.2.2/src/bindings/context.rs:146: undefined reference to `sass_delete_data_context'
          collect2: error: ld returned 1 exit status

Getting list of imports?

Is there a way to get a list (Vec<Path>) of @import-ed files? There doesn't seem to be an obvious and easy way, but maybe by creating a SassImporter?

Readme shows wrong function signatures

sass-rs exposes 2 functions that are self-explanatory:
compile_file(path: &str, options: Options)
compile_file<P: AsRef>(path: P, options: Options)

The first one should be compile_string(content: &str, options: Options).

It would also make sense to include the return types in the signatures..

0.4.13 release FTFB on NetBSD-9.99.15 amd64

While attempting yet another (manual. not pkgsrc) build of zola on NetBSD:

error: failed to run custom build command for `sass-sys v0.4.13`

Caused by:
  process didn't exit successfully: `/home/ng0/code/re-src/zola/target/release/build/sass-sys-9e579ec1d85a375b/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Build error:
STDERR:In file included from src/ast.hpp:19:0,
                 from src/ast_values.cpp:5:
src/util.hpp: In function 'T Sass::absmod(const T&, const T&)':
src/util.hpp:28:16: error: 'fmod' is not a member of 'std'
     T m = std::fmod(n, r);
                ^~~~
src/util.hpp:28:16: note: suggested alternative: 'find'
     T m = std::fmod(n, r);
                ^~~~
                find
In file included from src/ast.hpp:19:0,
                 from src/ast_sel_cmp.cpp:5:
src/util.hpp: In function 'T Sass::absmod(const T&, const T&)':
src/util.hpp:28:16: error: 'fmod' is not a member of 'std'
     T m = std::fmod(n, r);
                ^~~~
src/util.hpp:28:16: note: suggested alternative: 'find'
     T m = std::fmod(n, r);
                ^~~~
                find
In file included from src/ast.hpp:19:0,
                 from src/ast.cpp:2:
src/util.hpp: In function 'T Sass::absmod(const T&, const T&)':
src/util.hpp:28:16: error: 'fmod' is not a member of 'std'
     T m = std::fmod(n, r);
                ^~~~
src/util.hpp:28:16: note: suggested alternative: 'find'
     T m = std::fmod(n, r);
                ^~~~
                find
In file included from src/ast.hpp:19:0,
                 from src/ast_supports.cpp:5:
src/util.hpp: In function 'T Sass::absmod(const T&, const T&)':
src/util.hpp:28:16: error: 'fmod' is not a member of 'std'
     T m = std::fmod(n, r);
                ^~~~
src/util.hpp:28:16: note: suggested alternative: 'find'
     T m = std::fmod(n, r);
                ^~~~
                find
gmake: *** [Makefile:219: src/ast_supports.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake: *** [Makefile:219: src/ast_values.o] Error 1
gmake: *** [Makefile:219: src/ast.o] Error 1
gmake: *** [Makefile:219: src/ast_sel_cmp.o] Error 1

STDOUT:cc -Wall -O2 -I /home/ng0/code/re-src/zola/target/release/build/sass-sys-dbbbcd7c50e33157/out/build/include  -fPIC -c -o src/cencode.o src/cencode.c
g++ -Wall -O2 -std=c++11 -I /home/ng0/code/re-src/zola/target/release/build/sass-sys-dbbbcd7c50e33157/out/build/include  -fPIC -c -o src/ast.o src/ast.cpp
g++ -Wall -O2 -std=c++11 -I /home/ng0/code/re-src/zola/target/release/build/sass-sys-dbbbcd7c50e33157/out/build/include  -fPIC -c -o src/ast_values.o src/ast_values.cpp
g++ -Wall -O2 -std=c++11 -I /home/ng0/code/re-src/zola/target/release/build/sass-sys-dbbbcd7c50e33157/out/build/include  -fPIC -c -o src/ast_supports.o src/ast_supports.cpp
g++ -Wall -O2 -std=c++11 -I /home/ng0/code/re-src/zola/target/release/build/sass-sys-dbbbcd7c50e33157/out/build/include  -fPIC -c -o src/ast_sel_cmp.o src/ast_sel_cmp.cpp
', /home/ng0/.cargo/registry/src/github.com-1ecc6299db9ec823/sass-sys-0.4.13/build.rs:93:9
stack backtrace:
   0: std::sys_common::backtrace::print
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::continue_panic_fmt
   5: std::panicking::begin_panic_fmt
   6: build_script_build::main
   7: std::rt::lang_start::{{closure}}
   8: std::panicking::try::do_call
   9: __rust_maybe_catch_panic
  10: std::rt::lang_start_internal
  11: main
  12: ___start

warning: build failed, waiting for other jobs to finish...
error: build failed

Cargo build fails on M1 Mac

I'm getting an error when running cargo build on a clean checkout of the repository on an M1 Macbook, reproduced below.

$ cargo build
   Compiling sass-rs v0.2.2 (/Users/rodarmor/tmp/sass-rs)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.11zu9qqmtkpmi1h1.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.1ylcibwt7v2gbqnu.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2a2zc4ympfvgwctl.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2cs576hgsvt27fnr.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2ez1s1c64v2hii6i.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2i4433n9kjj2qzqx.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2idy93ogpt88zwgt.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2iiap59cqetk1p33.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2jm014oawnxiy0gk.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2p2e3e22x1wdj9y8.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.2tkvn5q4y6kejiph.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.39rl95p095r9vmu7.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.3biln48xi9d267q2.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.3lb6km972vbihlll.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.3vrk12ynvrnt50cn.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.3wcg8ayjawm91nvf.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.3wxuedx9599gsx7v.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.409qkb22r8opxhn9.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.42kq2ti760yqlgi9.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.48f2rn9zp2h8f4wz.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.4c8nysmeqzmokbt4.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.4ecljtg6ccfwk1.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.4jrep19k3ts5hkbl.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.4nowtd9q9vyyq0qr.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.51ptfmsy7iit7212.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.53shrd8a4kh3dpms.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.540u0s5jdx6d0ii9.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.54giriwxx7lgbwgq.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.54xkxkafmbrv5la2.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.56ct5k0rinu01llx.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.5cpnc2jn0f5e55tb.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.5ebr2kmxfqjxr080.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.cgd1361cb1jwgfn.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.utjk503vnrzpbyo.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.x4pxf7ecoaaeujj.rcgu.o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160.23sz62xxls202n6b.rcgu.o" "-L" "/Users/rodarmor/tmp/sass-rs/target/debug/deps" "-L" "/Users/rodarmor/tmp/sass-rs/target/debug/build/sass-sys-957816962f7ffe05/out/build/lib" "-L" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/libsass_rs-e64094553a5d304d.rlib" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/liblibc-b139fbd925289597.rlib" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/libsass_sys-88036183608fdfc5.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-81655915c211065a.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-6401d7836ab37fcf.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-bee3b45bdece0195.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-01c74ed3833459fe.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-48661015cf0226dd.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-f6cb12e379c9f859.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-01c2377d8875d7d3.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-4ecebe9133c1e15e.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-68b6457fbd59457b.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-9d4889633473e617.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-7d202cbf8f30fd4c.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-412e60c7c12b3b8f.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-45ccb8237a0071b3.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-24424da3181053ad.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-5789d203d1806d35.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-22574ec029e9d229.rlib" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-56bb43a121401f7f.rlib" "-liconv" "-lc++" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/rodarmor/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/rodarmor/tmp/sass-rs/target/debug/deps/sass_rs-0e88cc8290689160" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: in /Users/rodarmor/tmp/sass-rs/target/debug/deps/libsass_sys-88036183608fdfc5.rlib(sass_context.o), archive member 'sass_context.o' with length 55776 is not mach-o or llvm bitcode for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `sass-rs` due to previous error

Support source maps

Hi!
When developing, having source maps is a really nice feature to have, and as far as I know, libsass has built-in source-map support. Would it be possible to have this feature in sass-rs?

I would be happy to help with the implementation if I'm given some pointers, I don't know much about the C API (or where to find nice documentation about it).

Fail to read the correct file when calling compile_file

It can be reproduced with the latest release with the in-tree example:

โžœ  examples git:(30c99f1) RUST_BACKTRACE=1 cargo run --example compile_sass simple.sass
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `/home/kay/Documents/github/sass-rs/target/debug/examples/compile_sass simple.sass`
Compiling sass file: `simple.sass`.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Internal Error: File to read not found or unreadable: simple.sass\n"', src/libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:211
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:390
   6: rust_begin_unwind
             at src/libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:77
   8: core::result::unwrap_failed
             at /rustc/6acbb5b65c06d82c867a94c54ce51dab4707ac61/src/libcore/macros.rs:26
   9: <core::result::Result<T, E>>::unwrap
             at /rustc/6acbb5b65c06d82c867a94c54ce51dab4707ac61/src/libcore/result.rs:808
  10: compile_sass::main
             at examples/compile_sass.rs:12
  11: std::rt::lang_start::{{closure}}
             at /rustc/6acbb5b65c06d82c867a94c54ce51dab4707ac61/src/libstd/rt.rs:74
  12: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:310
  13: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:102
  14: std::rt::lang_start_internal
             at src/libstd/panicking.rs:289
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  15: std::rt::lang_start
             at /rustc/6acbb5b65c06d82c867a94c54ce51dab4707ac61/src/libstd/rt.rs:74
  16: main
  17: __libc_start_main
  18: _start

It seems there is a mysterious \n in the file path while trying to compile.

Doesn't compile on Windows

Found this error when trying to compile Gutenberg on Windows. Running from "x64 Native Tools Command Prompt for VS2017" so that Windows can find link.exe, I get:

   Compiling serde_json v1.0.9
   Compiling num-iter v0.1.35
   Compiling log v0.3.9
   Compiling crossbeam-epoch v0.3.0
   Compiling syn v0.11.11
error: failed to run custom build command for `sass-sys v0.4.3`
process didn't exit successfully: `c:\Users\Phil\repos\gutenberg-fork\target\debug\build\sass-sys-cda42525225dc0fb\build-script-build` (exit code: 101)
--- stderr
fatal: Not a git repository (or any of the parent directories): .git
thread 'main' panicked at 'error running msbuild: Error { repr: Os { code: 2, message: "The system cannot find the file specified." } }', src\libcore\result.rs:906:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

Running with RUST_BACKTRACE=1 gives

error: failed to run custom build command for `sass-sys v0.4.3`
process didn't exit successfully: `c:\Users\Phil\repos\gutenberg-fork\target\debug\build\sass-sys-cda42525225dc0fb\build-script-build` (exit code: 101)
--- stderr
fatal: Not a git repository (or any of the parent directories): .git
thread 'main' panicked at 'error running msbuild: Error { repr: Os { code: 2, message: "The system cannot find the file specified." } }', src\libcore\result.rs:906:4
stack backtrace:
   0: std::sys_common::backtrace::_print
             at C:\projects\rust\src\libstd\sys_common\backtrace.rs:91
   1: std::panicking::default_hook::{{closure}}
             at C:\projects\rust\src\libstd\panicking.rs:380
   2: std::panicking::default_hook
             at C:\projects\rust\src\libstd\panicking.rs:397
   3: std::panicking::rust_panic_with_hook
             at C:\projects\rust\src\libstd\panicking.rs:577
   4: std::panicking::begin_panic<alloc::string::String>
             at C:\projects\rust\src\libstd\panicking.rs:538
   5: std::panicking::begin_panic_fmt
             at C:\projects\rust\src\libstd\panicking.rs:522
   6: std::panicking::rust_begin_panic
             at C:\projects\rust\src\libstd\panicking.rs:498
   7: core::panicking::panic_fmt
             at C:\projects\rust\src\libcore\panicking.rs:71
   8: core::result::unwrap_failed<std::io::error::Error>
             at C:\projects\rust\src\libcore\macros.rs:23
   9: core::result::Result<std::process::Output, std::io::error::Error>::expect<std::process::Output,std::io::error::Error>
             at C:\projects\rust\src\libcore\result.rs:799
  10: build_script_build::compile
             at .\build.rs:57
  11: build_script_build::main
             at .\build.rs:91
  12: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:101
  13: std::rt::lang_start
             at C:\projects\rust\src\libstd\rt.rs:51
  14: main
  15: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  16: BaseThreadInitThunk

warning: build failed, waiting for other jobs to finish...
error: build failed

No targets specified and no makefile found

   Compiling sass-sys v0.4.15 (C:\sass-rs-master\sass-sys)
error: failed to run custom build command for `sass-sys v0.4.15
(C:\sass-rs-master\sass-sys)`

Caused by:
  process didn't exit successfully: `C:\sass-rs-master\target\debug\build\
  sass-sys-1bbb3f9bc67897ff\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Build error:
STDERR:make: *** No targets specified and no makefile found.  Stop.

STDOUT:', sass-sys\build.rs:93:9

Install

I dont see any install instruction. This is probably obvious, but it could be helpful to new users.

build with android-ndk failed

Command::new("cc")
        .arg("-xc++")
        .arg("-o/dev/null")
        .arg(format!("-l{}",lib))
        .arg("-shared")
        .stderr(Stdio::null())
        .status()
        .expect("Failed to run cc. Do you have it installed?")
        .success()

above command do not take cross-compilation into account. consider using crate cc, reference

Not building under Android termux

The library is not building under Android Termux.

The reason is that Termux uses -lc++ to link to the c++ library but sass-sys will try to link with -llibc++. The linker flags are currently hard tied to the target platform in the build.rs. There are Linux platforms that use -lc++ and also bsds that use -llibc++.

I changed the build.rs so that it tries to link the different possibilities and than selects the one that is available. If you like I can open a pull request.

Build fails on FreeBSD due to standard C++ library detection failure

Build on FreeBSD fails during linking because it cannot find libstdc++.

This is due to the way the detection mechanism works in build.rs:

sass-rs/sass-sys/build.rs

Lines 135 to 146 in 79e16d7

let libprobe = | lib: &str | -> bool {
Command::new("cc")
.arg("-xc++")
.arg("-o/dev/null")
.arg(format!("-l{}",lib))
.arg("-shared")
.stderr(Stdio::null())
.status()
.expect("")
.success()
};
_compile(libprobe);

The problem is that cc (which is clang) has a special logic for "-lstdc++", which means that it always passes, e.g.

# echo "int main {}" | cc -xc++ -lstdc++ -
# echo $?
0
#

When invoking c++ instead of cc, the resulting executable is still linked agains libc++ and not libstdc++. A detection mechanism based on c++ would need to use the -stdlib parameter to actually make a difference, e.g. c++ -stdlib=libstdc++, I'm not sure if this is portable. This might also affect darwin (but there the first option probed for usually works).

I'm happy to submit a patch, but it would be good to determine the best way to work around the issue first - I'm inclined to simply add a (Free)BSD specific patch that puts libc++ to the top of options probed.

Starts dozens (sometimes hundreds) of build processes

When building sass-sys, a huge number of cc1plus processes are started, to the point that my entire computer starts to lag and every CPU gets pinned at 100%. The number doesn't change even if I specify MAKE_LIBSASS_JOBS.

The title says "sometimes" because the number of jobs changes over time, possibly as make starts compiling new files/finishes with old ones, and I couldn't get a consistent number. It was always in the same range, though.

At least ctrl+C works fairly quickly to kill the entire bundle.

Platform: WSL (Ubuntu); rustc 1.36.0

Add maintenance status in the readme

In the last comment on #6, @Keats said that:

[...] this crate is not maintained anymore as libsass is deprecated. [...]

Thus, if sass-rs is no longer being maintained, perhaps adding a notice banner on the readme would help users in search of a Rust SASS compiler to move to other alternatives (not that there are too many).

Also, given that there are commits in the repository which are not yet released, perhaps making a one last release on crates.io?

Compile on windows VS2019, full windows environment (50GB all components) from dev console v16.9.6

7700b0c\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBSASS_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBSASS_STATIC
  cargo:rerun-if-env-changed=LIBSASS_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rustc-link-search=native=C:\Users\AppData\Local\Temp\cargo-installC5m3fH\release\build\sass-sys-1d0368ac83fcccc8\out\build\lib
  cargo:rustc-link-lib=static=sass

  --- stderr
  thread 'main' panicked at 'no c++ library found', C:\Users\.cargo\registry\src\github.com-1ecc6299db9ec823\sass-sys-0.4.21\build.rs:80:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Document OutputStyle

While it sounded intuitive in the documentation, I still felt compelled to make sure the four styles were what I expected them to be and ended up here:

https://web-design-weekly.com/2014/06/15/different-sass-output-styles/

Would you like some inline documentation examples of what the styles look like? Or maybe even just a disclaimer "it is what it says on the tin". Compressed vs Compact is fairly ambiguous if you haven't tested the settings by hand on your own.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.