Coder Social home page Coder Social logo

dart-sass-embedded's Introduction

Sass

@SassCSS on Twitter    stackoverflow    Gitter

Sass makes CSS fun again. Sass is an extension of CSS, adding nested rules, variables, mixins, selector inheritance, and more. It's translated to well-formatted, standard CSS using the command line tool or a plugin for your build system.

$font-stack: Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}

@mixin border-radius($radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;
}

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li { @include border-radius(10px); }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
  }
}

Install Sass

You can install Sass on Windows, Mac, or Linux by downloading the package for your operating system from GitHub and adding it to your PATH. That's all—there are no external dependencies and nothing else you need to install.

If you use Node.js, you can also install Sass using npm by running

npm install -g sass

However, please note that this will install the pure JavaScript implementation of Sass, which runs somewhat slower than the other options listed here. But it has the same interface, so it'll be easy to swap in another implementation later if you need a bit more speed!

See the Sass website for more ways to install Sass.

Once you have Sass installed, you can run the sass executable to compile .sass and .scss files to .css files. For example:

sass source/stylesheets/index.scss build/stylesheets/index.css

Learn Sass

Check out the Sass website for a guide on how to learn Sass!

This Repository

This repository isn't an implementation of Sass. Those live in sass/dart-sass and sass/libsass. Instead, it contains:

  • spec/, which contains specifications for language features.
  • proposal/, which contains in-progress proposals for changes to the language.
  • accepted/, which contains proposals that have been accepted and are either implemented or in the process of being implemented.

Note that this doesn't contain a full specification of Sass. Instead, feature specifications are written as needed when a new feature is being designed or when an implementor needs additional clarity about how something is supposed to work. This means many of the specs in spec/ only cover small portions of the features in question.

Versioning Policy

The proposals in this repository are versioned, to make it easy to track changes over time and to refer to older versions. Every version has a Git tag of the form proposal.<name>.draft-<version>. A new version should be created for each batch of changes.

Every version has a major version, and they may have a minor version as well (indicated <major>.<minor>). The minor version should be incremented for changes that don't affect the intended semantics of the proposal; otherwise, the major version should be incremented.

dart-sass-embedded's People

Contributors

ahabhgk avatar cmahnke avatar dependabot[bot] avatar goodwine avatar jathak avatar nex3 avatar ntkme avatar sassbot avatar stof 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dart-sass-embedded's Issues

Unstable release archives

See

image

Version 1.56.1 was released in November, yet the archives was updated 15 hours ago.

I'm maintaining Hugo and we compare sha256 sums for these archives before we start using them -- which, not surprisingly, now starts to fail.

Was this a one time thing or do we need to somehow store these archives ourselves?

Alpine linux support?

Good day.

I am trying to use dart-sass-embedded in Docker image builded from official node:18-alpine image.

By default dart-sass-embedded dont work on alpine with error:

bash-5.1# ./dist/lib/src/vendor/dart-sass-embedded/dart-sass-embedded
bash: ./dist/lib/src/vendor/dart-sass-embedded/dart-sass-embedded: No such file or directory

I tried install apk add build-base gcompat or apk add libc6-compat but had same error:

bash-5.1# ./dist/lib/src/vendor/dart-sass-embedded/dart-sass-embedded
Segmentation fault

I tried to use gdb to find fault details but dart-sass-embedded has no debugging symbols.

On install download-compiler-for-end-user.js downloaded https://github.com/sass/dart-sass-embedded/releases/download/1.50.1/sass_embedded-1.50.1-linux-x64.tar.gz inside alphine Docker.

Is where any chase to exec dart sass on alpine?

BTW. It was very hard to find out real reason of problem. I spend some house in debugging. It will be grate if node sass-embedded module can show details if binary broken then is try to exec it.

Builds for Mac OS broken

The release tgz for Linux x86 only contains one big executable, where the binaries for OS X are jus stubs, needing access to the src directory. This is quite inconvenient in terms of (cross platform) scripting and litters /usr/local/bin (or any other installation directory).

Please provide a uniform file layout across platforms (which would be just one big executable without dependencies to src). Or don't advertise archives as binary packages, if they really aren't.

One might use a tool like makeself to emulate such a behaviour.

1.52.1 release: `--version` reports 1.51.0

I just downloaded 1.52.1 and put the binary in my $PATH, but got the following response when I did dart-sass-embedded --version:

{
  "protocolVersion": "1.0.0",
  "compilerVersion": "1.51.0",
  "implementationVersion": "1.51.0",
  "implementationName": "Dart Sass",
  "id": 0
}

Inconsistent packaging of linux-x64 in version 1.0.0-beta.7

The linux-x64 variant of version 1.0.0-beta.7 is packaged slightly differently than the other packages.

For version 1.0.0-beta.6 all 5 variants were packaged the same way:

  • A dart executable (sass_embedded/src/dart(.exe))
  • A snapshot of dart-sass-embedded (sass_embedded/src/dart-sass-embedded.snapshot)
  • A shell script combining both (sass_embedded/dart-sass-embedded(.bat))

For version 1.0.0-beta.7 all variants - except for linux-x64 - are still packaged the same way.
The linux-x64 however does not contain a sass executable nor a dart-sass-embedded.snapshot file and instead of the shell script there is just one fully executable binary.

It would be easier for host implementors if all variants were packaged the same way.

Build native executables for macos-arm64

I've just done some performance comparisons on my M1 Mac I wanted to share with you:

It seems that the macos-x64 variant of dart-sass-embedded running on Rosetta 2 is faster than the 'native' macos-arm64 variant.
The macos-x64 variant is also much smaller (~3MB vs ~16MB)

Test 1

Executing this shell command:

time dart-sass-embedded --version

macos-x64 on Rosetta: ~40-50 ms
macos-arm64 native: ~70-80 ms

Test 2

Compiling the following SCSS 100 times:

.foo { .bar { color : #ffffff; @warn 'haha';}}

macos-x64 on Rosetta: ~90 ms
macos-arm64 native: ~110-130 ms

Does somebody have an explanation for this?
Or does someone notices similar problems?

With the current status, I'm actually considering not to bundle the native arm variant into https://github.com/larsgrefer/dart-sass-java anymore as it seems superfluous to carry the extra 16 MB for worse performance.

Linux packaging with 1.58.0 and later

With v1.57.1 and earlier, the Linux x64 package contained a single executable.

That changed with 1.58.0 and later, making manual installation a bit more complicated for casual users.

Was the change intentional?

The compiler does not work on linux Alpine

Hi! Unfortunately, dart-sass-embedded binaries not working on linux Alpine.

# ./dart-sass-embedded 
./dart-sass-embedded: No such file or directory

# ldd ./dart-sass-embedded
        /lib64/ld-linux-x86-64.so.2 (0x7f6df5957000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f6df5957000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f6df5957000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f6df5957000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f6df5957000)
        ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x7f6df52cc000)
Error relocating ./dart-sass-embedded: __sbrk: symbol not found

Can you fix that?

Failure when installing sass_embedded in a docker container

When adding sass-embedded to the Gemfile, the installation fails on a docker image based on jekyll/jekyll:4.2.2 and on a amd64 machine. Here's the output:

Fetching sass-embedded-1.54.3.gem
Successfully installed google-protobuf-3.21.4-x86_64-linux
Building native extensions. This could take a while...
ERROR:  Error installing sass-embedded:
        ERROR: Failed to build gem native extension.

    current directory: /usr/gem/gems/sass-embedded-1.54.3/ext/sass
/usr/local/bin/ruby -I/usr/local/lib/ruby/site_ruby/3.1.0 -rrubygems /usr/local/lib/ruby/gems/3.1.0/gems/rake-13.0.6/exe/rake RUBYARCHDIR\=/usr/gem/extensions/x86_64-linux-musl/3.1.0/sass-embedded-1.54.3 RUBYLIBDIR\=/usr/gem/extensions/x86_64-linux-musl/3.1.0/sass-embedded-1.54.3
rake aborted!
NotImplementedError: sass_embedded for x86_64-linux-musl not available at https://github.com/sass/dart-sass-embedded/releases/tag/1.54.3
/usr/gem/gems/sass-embedded-1.54.3/ext/sass/Rakefile:177:in `default_sass_embedded'
/usr/gem/gems/sass-embedded-1.54.3/ext/sass/Rakefile:19:in `block (2 levels) in <top (required)>'
/usr/gem/gems/sass-embedded-1.54.3/ext/sass/Rakefile:19:in `fetch'
/usr/gem/gems/sass-embedded-1.54.3/ext/sass/Rakefile:19:in `block in <top (required)>'
Tasks: TOP => default => install => sass_embedded
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /usr/gem/gems/sass-embedded-1.54.3 for inspection.

Breaks for github actions

When I try to deploy a site using github actions, and it uses sass, this error appears:

Fetching html-pipeline 2.14.3
Installing html-pipeline 2.14.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass
/usr/local/bin/ruby -I/usr/local/lib/ruby/2.7.0/rubygems -rrubygems
/github/workspace/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake
RUBYARCHDIR\=/github/workspace/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux-musl/2.7.0/sass-embedded-1.57.1
RUBYLIBDIR\=/github/workspace/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux-musl/2.7.0/sass-embedded-1.57.1
rake aborted!
NotImplementedError: sass_embedded for x86_64-linux-musl not available at
https://github.com/sass/dart-sass-embedded/releases/tag/1.57.1
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:226:in
`default_sass_embedded'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:21:in
`block (2 levels) in <top (required)>'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:21:in
`fetch'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:21:in
`block in <top (required)>'
/github/workspace/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in
`<main>'
Tasks: TOP => default => install => embedded.rb => sass_embedded
(See full trace by running task with --trace)

rake failed, exit code 1

The pubspec.lock file should be committed

Given that dart-sass-embedded is an application, the pubspec.lock file should probably be committed, which would help achieving reproducible builds too (not sure this will be enough to achieve it)

fileImportRequest does not have id set

require 'sass-embedded'

10.times do
  Thread.new do
    Sass.compile_string('@import "not-found.scss"', importers: [{ find_file_url: ->(*) { sleep 1; nil } }])
  end
end

Thread.list.each do |t|
  t.join unless t == Thread.current
end

Verbose log:

Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 0, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 1, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 2, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 3, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 4, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 5, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 6, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 7, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 8, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: compile_request: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest: id: 9, style: :EXPANDED, source_map: false, importers: [<Sass::EmbeddedProtocol::InboundMessage::CompileRequest::Importer: file_importer_id: 0>], global_functions: [], alert_color: true, alert_ascii: false, verbose: false, quiet_deps: false, source_map_include_sources: false, string: <Sass::EmbeddedProtocol::InboundMessage::CompileRequest::StringInput: source: "@import "not-found.scss"", url: "", syntax: :SCSS>>>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 0, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 1, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 2, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 3, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 4, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 5, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 6, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 7, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 8, importer_id: 0, url: "not-found.scss", from_import: true>
Receiving: <Sass::EmbeddedProtocol::OutboundMessage::FileImportRequest: id: 0, compilation_id: 9, importer_id: 0, url: "not-found.scss", from_import: true>
Sending: <Sass::EmbeddedProtocol::InboundMessage: file_import_response: <Sass::EmbeddedProtocol::InboundMessage::FileImportResponse: id: 0>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: file_import_response: <Sass::EmbeddedProtocol::InboundMessage::FileImportResponse: id: 0>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: file_import_response: <Sass::EmbeddedProtocol::InboundMessage::FileImportResponse: id: 0>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: file_import_response: <Sass::EmbeddedProtocol::InboundMessage::FileImportResponse: id: 0>>
Sending: <Sass::EmbeddedProtocol::InboundMessage: file_import_response: <Sass::EmbeddedProtocol::InboundMessage::FileImportResponse: id: 0>>
/usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/compiler.rb:19: warning: Host caused params error: Response ID 0 doesn't match any outstanding requests.
Receiving: <Sass::EmbeddedProtocol::ProtocolError: type: :PARAMS, id: 4294967295, message: "Response ID 0 doesn't match any outstanding requests.">
Sending: <Sass::EmbeddedProtocol::InboundMessage: file_import_response: <Sass::EmbeddedProtocol::InboundMessage::FileImportResponse: id: 0>>
#<Thread:0x00007d92dec66210 test.rb:4 run> terminated with exception (report_on_exception is true):
: Response ID 0 doesn't match any outstanding requests. (Sass::CompileError)
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/async.rb:53:in `synchronize'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/async.rb:53:in `await'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:135:in `block in await'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:129:in `synchronize'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:129:in `await'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:43:in `compile_request'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded.rb:199:in `compile_string'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded.rb:45:in `compile_string'
        from test.rb:5:in `block (2 levels) in <main>'
#<Thread:0x00007d92dec64bb8 test.rb:4 run> terminated with exception (report_on_exception is true):
/usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/async.rb:56:in `block in await': Response ID 0 doesn't match any outstanding requests. (Sass::CompileError)
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/async.rb:53:in `synchronize'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/async.rb:53:in `await'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:135:in `block in await'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:129:in `synchronize'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:129:in `await'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded/host.rb:43:in `compile_request'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded.rb:199:in `compile_string'
        from /usr/local/bundle/gems/sass-embedded-1.2.3/lib/sass/embedded.rb:45:in `compile_string'
        from test.rb:5:in `block (2 levels) in <main>'

Custom importer not invoked when CompileRequest.Url points to a real file

I'm not sure if this repo is the right one, but here you go:

  • I fill out the Url in the request mainly to get a correct source map
  • When this Url points to an existing file, the custom importers defined is not invoked
  • My current workaround is to put a dummy value as a placeholder here and then replace that in the source map I get-

This is tested with beta 5.

message := &embeddedsass.InboundMessage_CompileRequest_{
			CompileRequest: &embeddedsass.InboundMessage_CompileRequest{
				Importers: customImporters,
				Input: &embeddedsass.InboundMessage_CompileRequest_String_{
					String_: &embeddedsass.InboundMessage_CompileRequest_StringInput{
						Source: "@import \"colors;\"",
						Url:    "file:///styles/main.scss",
					},
				},
			},
		}

How to add this to dart-sass already installed?

Hi,
I'm developing a Hugo website. I have installed both Hugo and Sass thro choco in my windows.

hugo version
hugo v0.96.0-2fd4a7d3d6845e75f8b8ae3a2a7bd91438967bbb+extended windows/amd64 BuildDate=2022-03-26T09:15:58Z VendorInfo=gohugoio

sass --version
1.49.9

I'm not sure how to add this dart-sass-embedded to the dart-sass already installed?

image

image

How to add this wrapper ? and to PATH?
In Ubuntu also, I didn't succeed.

https://discourse.gohugo.io/t/extended-hugo-version-is-not-working/37718

Ruby Host Implementation

Just want to share that I created a host implementation for ruby: https://github.com/ntkme/embedded-host-ruby

It can be installed with:

gem install sass-embedded

Unlike the scssc-ruby, the API is made to be close to the JavaScript API, except that for options it uses symbol in snake case instead of string in camel case. E.g. :indented_syntax instead of indentedSyntax.

require "sass"

Sass.render(file: "style.scss")

Example output:

irb(main):001:0> require "sass"
=> true
irb(main):002:0> 
irb(main):003:2* Sass.render(
irb(main):004:2*   data: "h1 { color: black; }",
irb(main):005:2*   indented_syntax: false
irb(main):006:0> )
=> {:css=>"h1 {\n  color: black;\n}", :map=>"", :stats=>{:entry=>"data", :start=>1621839779808, :end=>1621839779826, :duration=>18}}

Imports shall not be resolved relative to working directory of dart-sass-embedded process

compileString should not resolve imports relative to working directory of compiler process.

This issue can be reproduced with both node host and ruby host.

Correct behavior of throwing [Error]: Can't find stylesheet to import on sass:

const fs = require('fs')
const sass = require('sass')
fs.writeFileSync('child.scss', 'a{b:c}');
console.log(sass.compileString('@import "child.scss";').css)

Reproduction with node host:

const fs = require('fs')
const sass = require('sass-embedded')
fs.writeFileSync('child.scss', 'a{b:c}');
console.log(sass.compileString('@import "child.scss";').css)

Reproduction with ruby host (fixed in 1.3.0, need version before <1.3 to reproduce):

require 'sass-embedded'
File.write('child.scss', 'a{b:c}')
puts Sass.compile_string('@import "child.scss";').css

Since ruby host has the capability of launching embedded compiler process and keep re-using it, here is another experiment involving changing working directory on host after embedded compiler has been launched:

require 'sass-embedded'
File.write('child.scss', 'a{b:c}')
Sass.info # launch dart-sass-embedded in the same working directory as host
Dir.chdir '/tmp' do # change working directory of host
  # import can still be resolved relative to compiler's working directory
  puts Sass.compile_string('@import "child.scss";').css
end

Versionning policy regarding dart-sass

It looks like the binary releases of dart-sass-embedded are bundling a dart-sass release in them (as it is a pub dependency). for now, it looks like the version numbers of dart-sass-embedded are totally decoupled from the dart-sass release. This makes it hard to figure out which version of dart-sass ends up being used (which is relevant for support of sass features).

Wouldn't it make sense to release this repository with a version number synced with the one of dart-sass and ensuring that a new release of dart-sass-embedded is done each time dart-sass gets released ?

Range checks don't respect the protocol

Range checks are defined in the protocol as respecting the Sass precision, meaning values within 1e-11 of the bounds are still considered to be in the range.
But the implementation in

/// Throws a parameter error if [value] isn't between [lower] and [upper], both
/// inclusive.
///
/// Returns [value] if it is within the range.
T _checkInRange<T extends num>(String field, T value, num lower, num upper) {
if (value < lower) {
throw paramsError(
'$field must be greater than or equal to $lower, was $value');
} else if (value > upper) {
throw paramsError(
'$field must be less than or equal to $upper, was $value');
} else {
return value;
}
}
does not respect that.

The compiler does not work on Linux-x64

The v1.49.9 compiler blocks on Linux-x64 (while working fine on Windoes & Mac).

  • --version shows the Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "linux_x64" instead of compiler info
    • { "protocolVersion": "1.0.0", "compilerVersion": "1.49.9", "implementationVersion": "1.49.9", "implementationName": "Dart Sass", "id": 0 }
  • I suspect the problem related to the new self-consistent packaging (possible related issue: #38 )

Simple test:

const sass = require('sass-embedded');
const result = sass.compile("test.scss"); // blocks here
console.log(result)

why not support older versions of glibc?

For upgrading projects, would be nice to have support for older versions.

[]# ./dart-sass-embedded
./dart-sass-embedded: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./dart-sass-embedded)
./dart-sass-embedded: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by ./dart-sass-embedded)
./dart-sass-embedded: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by ./dart-sass-embedded)

Documentation

Is there any documentation for this?

Is there any way to try it with the Angular CLI?

Versionning for the implemented protocol

AFAICT, the client-side and server-side implementations of the embedded protocol need to use the same version of the protocol to be compatible.
It would be great if the dart-sass-embedded executable could report the version of the protocol for which it has been compiled, to make it easier to check for such issues.

question: Any estimated time for a release?

I maintain Hugo (written in Go), a project that looks forward to replacing the now deprecated LibSASS with embedded Dart Sass.

A "we have no idea" answer is better than nothing, and I totally understand that dates and open source isn't easy.

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.