Coder Social home page Coder Social logo

sass-contrib / sass-embedded-host-ruby Goto Github PK

View Code? Open in Web Editor NEW
61.0 4.0 5.0 925 KB

:gem: A Ruby library that will communicate with Embedded Dart Sass using the Embedded Sass protocol

Home Page: https://rubygems.org/gems/sass-embedded

License: MIT License

Ruby 99.99% PowerShell 0.01%
sass scss dart-sass sass-embedded protobuf ruby

sass-embedded-host-ruby's Introduction

Embedded Sass Host for Ruby

build gem

This is a Ruby library that implements the host side of the Embedded Sass protocol.

It exposes a Ruby API for Sass that's backed by a native Dart Sass executable.

Install

gem install sass-embedded

Usage

The Ruby API provides two entrypoints for compiling Sass to CSS.

  • Sass.compile takes a path to a Sass file and return the result of compiling that file to CSS.
require 'sass-embedded'

result = Sass.compile('style.scss')
puts result.css

compressed = Sass.compile('style.scss', style: :compressed)
puts compressed.css
  • Sass.compile_string takes a string that represents the contents of a Sass file and return the result of compiling that file to CSS.
require 'sass-embedded'

result = Sass.compile_string('h1 { font-size: 40px; }')
puts result.css

compressed = Sass.compile_string('h1 { font-size: 40px; }', style: :compressed)
puts compressed.css

See rubydoc.info/gems/sass-embedded/Sass for full API documentation.


Disclaimer: this is not an official Google product.

sass-embedded-host-ruby's People

Contributors

dependabot[bot] avatar ntkme 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

Watchers

 avatar  avatar  avatar  avatar

sass-embedded-host-ruby's Issues

bundle install failed for 1.54.6 on linux

  Your bundle is locked to sass-embedded (1.54.6-x86_64-linux) from rubygems
  repository https://rubygems.org/ or installed locally, but that version can no
  longer be found in that source. That means the author of sass-embedded
  (1.54.6-x86_64-linux) has removed it. You'll need to update your bundle to a
  version other than sass-embedded (1.54.6-x86_64-linux) that hasn't been removed
  in order to install.

Cannot support NixOS

This gem will download .bundle/ruby/2.7.0/gems/sass-embedded-1.61.0-x86_64-linux-gnu/ext/sass/sass_embedded/src/dart for me. However, My OS is NixOS, which doesn't respect HFS so it must patchelf every program respect HFS. How can I use the dart installed by nix (package manager of NixOS) to replace the downloaded dart? That is it will search dart in $PATH, then use it, not use .bundle/ruby/2.7.0/gems/sass-embedded-1.61.0-x86_64-linux-gnu/ext/sass/sass_embedded/src/dart directly. Thanks!

sass-embedded 0.19.2 causes NameError

Reproduction code:

require "sass-embedded"

Result:

/Users/XXXXX/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/sass-embedded-0.19.2/lib/sass/embedded/legacy.rb:376:in `<module:Url>': uninitialized constant Sass::Embedded::Url::URI (NameError)

      URI_PARSER = URI::Parser.new({ RESERVED: ';/?:@&=+$,' })
                   ^^^

Lack of integrity verification of downloaded external dependencies

Hey,

My name is Maciej Mensfeld and I run a research security project called WhiteSource Diffend.io.

I've noticed, that this library downloads some external resources and uses them. While it's a totally common pattern, what is lacking here is integrity verification.

You could verify the integrity of the downloaded files before using them by comparing the files hashes to a hardcoded, expected files hashes.

This is essentially what package managers do to verify the integrity of downloaded packages.

Doing this would prevent attack scenarios in which sass-embedded is manipulated.

Have a great day :)

ref: https://my.diffend.io/gems/sass-embedded/0.1.0/page/1#d2h-090432-2851

Encoding::UndefinedConversionError, but only under Rails

I've hacked together a minimal Sprockets::SassProcessor implementation for using sass-embedded with Sprockets 4. It actually seems to work pretty well for the basic case I'm using it for, but if I include any gem directories in include_paths, it fails with an Encoding::UndefinedConversionError in Sass::Transport#write_varint.

The odd thing is this only happens in a Rails environment — if I write a script that passes the same input application.scss and an identical array of include_paths, it succeeds. I assume Rails is somewhere, somehow, messing with the encoding of the stdin stream returned by Open3.popen3, but I don't really know.

Steps to reproduce

  1. download the script sass.rb from this gist to /tmp
  2. edit the paths in the script as appropriate for your environment
  3. in a Rails app:
    • ensure sass and sassc are not in the Gemfile

    • add sass-embedded to the Gemfile

    • run bundle install

    • run rails console and execute the following:

      eval(File.read('/tmp/sass.rb'))

Expected

  • compiled CSS is output

Actual

  • error Encoding::UndefinedConversionError ("\x9B" from ASCII-8BIT to UTF-8)
    (or similar) in Sass::Transport#write_varint

Building sass-embedded fails on Nix

Hi,

I'm trying to build Jekyll for my NixOS server, which depends on sass-embedded. The build currently fails due to the Rakefile trying to fetch an archive from github, as nix derivations do not have internet access during build time:

building '/nix/store/04rabbrj3wgk7nxahz87wq0nsnyzl9c7-ruby2.7.6-sass-embedded-1.58.0.drv'...
unpacking sources
patching sources
configuring
no configure script, doing nothing
installing
buildFlags: 
WARNING:  You build with buildroot.
  Build root: /
  Bin dir: /nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/bin
  Gem home: /nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0
  Plugins dir: /nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/plugins
Building native extensions. This could take a while...
ERROR:  Error installing /nix/store/x4dvi7mffypdbm3755vy221hjc2bapd9-sass-embedded-1.58.0.gem:
        ERROR: Failed to build gem native extension.

    current directory: /nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/gems/sass-embedded-1.58.0/ext/sass
/nix/store/cf2fghb8vxxwmniv8cl6cvsyzabjrvl3-ruby-2.7.6/bin/ruby -I/nix/store/cf2fghb8vxxwmniv8cl6cvsyzabjrvl3-ruby-2.7.6/lib/ruby/2.7.0 -rrubygems /nix/store/cf2fghb8vxxwmniv8cl6cvsyzabjrvl3-ruby-2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.1/exe/rake RUBYARCHDIR\=/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/sass-embedded-1.58.0 RUBYLIBDIR\=/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/sass-embedded-1.58.0
fetch https://github.com/sass/dart-sass-embedded/releases/download/1.58.0/sass_embedded-1.58.0-linux-x64.tar.gz
rake aborted!
SocketError: Failed to open TCP connection to github.com:443 (getaddrinfo: Temporary failure in name resolution)
/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/gems/sass-embedded-1.58.0/ext/sass/Rakefile:176:in `public_send'
/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/gems/sass-embedded-1.58.0/ext/sass/Rakefile:176:in `fetch'
/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/gems/sass-embedded-1.58.0/ext/sass/Rakefile:21:in `block in <top (required)>'

Caused by:
SocketError: getaddrinfo: Temporary failure in name resolution
/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/gems/sass-embedded-1.58.0/ext/sass/Rakefile:176:in `public_send'
/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/gems/sass-embedded-1.58.0/ext/sass/Rakefile:176:in `fetch'
/nix/store/rf9dnjclddg2ksyhycakq6jizkshv7dx-ruby2.7.6-sass-embedded-1.58.0/lib/ruby/gems/2.7.0/gems/sass-embedded-1.58.0/ext/sass/Rakefile:21:in `block in <top (required)>'
Tasks: TOP => default => install => embedded.rb => sass_embedded
(See full trace by running task with --trace)

rake failed, exit code 1

I looked at ect/sass/Rakefile#L270 and it seems that default_sass_embedded, default_protoc and default_sass_embedded_protocol all rely on fetching files from github. Is there a way to override those with local file paths?

Upgrade sass-embedded from 1.66.1 to 1.67.0 problem

after upgrade to 1.67.0 get an error

SassC::SyntaxError - Error: Can't find stylesheet to import.
  ╷
1 │ @import "sassc-embedded-import:1";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  sassc-embedded-import:0 1:9                                                            @import

          /home/app/assets/stylesheets/application.scss 14:9  root stylesheet
            /home/vendor/bundle/ruby/3.2.0/gems/dartsass-ruby-3.0.1/lib/sassc/engine.rb:58:in `rescue in render'
            /home/vendor/bundle/ruby/3.2.0/gems/dartsass-ruby-3.0.1/lib/sassc/engine.rb:22:in `render'
            /home/vendor/bundle/ruby/3.2.0/gems/dartsass-sprockets-3.0.0/lib/sassc/rails/template.rb:40:in `block in call'
            /home/vendor/bundle/ruby/3.2.0/gems/sprockets-4.2.1/lib/sprockets/utils.rb:145:in `block in module_include'
            /home/vendor/bundle/ruby/3.2.0/gems/sprockets-4.2.1/lib/sprockets/utils.rb:130:in `synchronize'
            /home/vendor/bundle/ruby/3.2.0/gems/sprockets-4.2.1/lib/sprockets/utils.rb:130:in `module_include'

any ideas what could went wrong?

Error fetching embedded sass protocol beta 17

ERROR: Error fetching https://raw.githubusercontent.com/sass/embedded-protocol/1.0.0-beta.17/embedded_sass.proto:
/Users/chris/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:387:in open_http': 404 Not Found (OpenURI::HTTPError) from /Users/chris/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:764:in buffer_open'
from /Users/chris/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:235:in block in open_loop' from /Users/chris/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:233:in catch'
from /Users/chris/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:233:in open_loop' from /Users/chris/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:174:in open_uri'
from /Users/chris/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:744:in open' from extconf.rb:64:in fetch'
from extconf.rb:46:in fetch_with_config' from extconf.rb:36:in initialize'
from extconf.rb:224:in new' from extconf.rb:224:in

'
curl -fsSLo /Users/chris/.rvm/gems/ruby-2.7.0/gems/sass-embedded-0.9.3/ext/sass/embedded_sass.proto -- https://raw.githubusercontent.com/sass/embedded-protocol/1.0.0-beta.17/embedded_sass.proto
make: *** [embedded_sass.proto] Error 1

Upgrading sass-embedded from 1.62.1 to 1.63.x causes tooling to generate wrong RBI for Sass::EmbeddedProtocol::Value::ArgumentList

Might be an upstream issue but wanted to start here...

In my gemfile.lock:

    sass-embedded (1.63.4-x86_64-darwin)
      google-protobuf (~> 3.23)

Using google-protobuf 3.23.3 (x86_64-darwin)

After running bin/tapioca dsl Sass::EmbeddedProtocol::Value::ArgumentList
Generated sorbet/rbi/dsl/sass/embedded_protocol/value/argument_list.rbi:

# typed: true

# DO NOT EDIT MANUALLY
# This is an autogenerated file for dynamic methods in `Sass::EmbeddedProtocol::Value::ArgumentList`.
# Please instead update this file by running `bin/tapioca dsl Sass::EmbeddedProtocol::Value::ArgumentList`.

class Sass::EmbeddedProtocol::Value::ArgumentList
...
  sig { returns(Google::Protobuf::RepeatedField[]) }
  def keywords; end
...
end

output of srb tc:

sorbet/rbi/dsl/sass/embedded_protocol/value/argument_list.rbi:45: Wrong number of type parameters for Google::Protobuf::RepeatedField. Expected: 1, got: 0 https://srb.help/7010
    45 |  sig { params(value: Google::Protobuf::RepeatedField[]).void }

Previous gemfile.lock:

    sass-embedded (1.62.1-x86_64-darwin)
      google-protobuf (~> 3.21)

Using google-protobuf 3.23.3 (x86_64-darwin) (forced it to this version to narrow down the issue)

RBI signature (having correct Map type for value):

  sig { params(value: Google::Protobuf::Map[String, Sass::EmbeddedProtocol::Value]).void }
  def keywords=(value); end

Output of srb tc:
No errors! Great job.

started getting error `that version can no longer be found in that source` error

after the new release its started to fail in actions. Works fine in local but I can't use the updated version of my jekyll website in my github page anymore.
Any ideas?

2022-12-26T11:40:27.7759734Z Your bundle is locked to sass-embedded (1.57.1-x86_64-linux) from rubygems
2022-12-26T11:40:27.7760625Z repository https://rubygems.org/ or installed locally, but that version can no
2022-12-26T11:40:27.7761977Z longer be found in that source. That means the author of sass-embedded
2022-12-26T11:40:27.7762673Z (1.57.1-x86_64-linux) has removed it. You'll need to update your bundle to a
2022-12-26T11:40:27.7763310Z version other than sass-embedded (1.57.1-x86_64-linux) that hasn't been removed
2022-12-26T11:40:27.7763758Z in order to install.

https://github.com/kKerem/kkerem.github.io/actions/runs/3781014955

fail to install Could not find sass-embedded-1.58.3-x86_64-linux.gem

after setup jekyll i'm trying to deploy to a dokku host

but the log show this
someone can say that this issue is related to this gem?

 In Gemfile:
       jekyll-seo-tag was resolved to 2.8.0, which depends on
       jekyll was resolved to 4.3.2, which depends on
       jekyll-sass-converter was resolved to 3.0.0, which depends on
       sass-embedded
       Bundler Output: Using public_suffix 5.0.1
       Using addressable 2.8.1
       Using bundler 2.3.10
       Using colorator 1.1.0
       Using concurrent-ruby 1.2.2
       Using eventmachine 1.2.7
       Using http_parser.rb 0.8.0
       Using em-websocket 0.5.3
       Using ffi 1.15.5
       Using forwardable-extended 2.6.0
       Using google-protobuf 3.22.0 (x86_64-linux)
       Using i18n 1.12.0
       Installing sass-embedded 1.58.3 (x86_64-linux)
       Bundler::GemNotFound: Could not find sass-embedded-1.58.3-x86_64-linux.gem for
       installation
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/source/rubygems.rb:181:in
       `install'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer/gem_installer.rb:54:in
       `install'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer/gem_installer.rb:16:in
       `install_from_spec'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer/parallel_installer.rb:186:in
       `do_install'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer/parallel_installer.rb:171:in
       `install_serially'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer/parallel_installer.rb:97:in
       `call'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer/parallel_installer.rb:71:in
       `call'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer.rb:259:in
       `install_in_parallel'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer.rb:209:in
       `install'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer.rb:89:in
       `block in run'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/process_lock.rb:12:in
       `block in lock'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/process_lock.rb:9:in
       `open'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/process_lock.rb:9:in
       `lock'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer.rb:71:in
       `run'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/installer.rb:23:in
       `install'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli/install.rb:62:in
       `run'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:255:in
       `block in install'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/settings.rb:131:in
       `temporary'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:254:in
       `install'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in
       `run'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in
       `invoke_command'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor.rb:392:in
       `dispatch'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:31:in
       `dispatch'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in
       `start'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:25:in
       `start'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/exe/bundle:48:in
       `block in <top (required)>'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/lib/bundler/friendly_errors.rb:103:in
       `with_friendly_errors'
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.10/exe/bundle:36:in `<top
       (required)>'
       /tmp/build/vendor/bundle/ruby/2.7.0/bin/bundle:23:in `load'
       /tmp/build/vendor/bundle/ruby/2.7.0/bin/bundle:23:in `<main>'
       
       An error occurred while installing sass-embedded (1.58.3), and Bundler cannot
       continue.
       
       In Gemfile:
       jekyll-seo-tag was resolved to 2.8.0, which depends on
       jekyll was resolved to 4.3.2, which depends on
       jekyll-sass-converter was resolved to 3.0.0, which depends on
       sass-embedded
       
       !
       !     Failed to install gems via Bundler.
       !
remote:  !     Failure during app build
remote:  !     Removing invalid image tag dokku/central:latest
remote:  !     App build failed

Build error on Alpine s390x

Hi, I got the following error trying to install Jekyll (which depends on jekyll-sass-converter which in turn depends on sass-embedded) in a Docker image based on ruby:3.1.3-alpine3.17. This is a multi-architecture build and the same Dockerfile command (i.e. RUN gem install jekyll -v4.3.2 -- --use-system-libraries) passed for all architectures but for linux/s390x which failed with this error which I do not really understand.

#94 [linux/s390x  9/24] RUN gem install jekyll -v4.3.2 --     --use-system-libraries
#94 504.2 Successfully installed google-protobuf-3.21.12
#94 504.2 Building native extensions with: '--use-system-libraries'
#94 504.2 This could take a while...
#94 507.4 ERROR:  Error installing jekyll:
#94 507.4 	ERROR: Failed to build gem native extension.
#94 507.4 
#94 507.4     current directory: /usr/gem/gems/sass-embedded-1.58.0/ext/sass
#94 507.4 /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/s390x-linux-musl/3.1.0/sass-embedded-1.58.0 RUBYLIBDIR\=/usr/gem/extensions/s390x-linux-musl/3.1.0/sass-embedded-1.58.0 --use-system-libraries
#94 507.4 invalid option: --use-system-libraries
#94 507.4 
#94 507.4 rake failed, exit code 1
#94 507.4 
#94 507.4 Gem files will remain installed in /usr/gem/gems/sass-embedded-1.58.0 for inspection.
#94 507.4 Results logged to /usr/gem/extensions/s390x-linux-musl/3.1.0/sass-embedded-1.58.0/gem_make.out
#94 ERROR: process "/bin/sh -c gem install jekyll -v4.3.2 --     --use-system-libraries" did not complete successfully: exit code: 1

Let me know if I can help debug it any further.

v1.55.0+ won't install on Windows

I get the following error when trying to install sass-embedded gem using bundler:

Installing sass-embedded 1.55.0 (was 1.56.1) with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
G:/Devkits/Ruby31-x64/lib/ruby/gems/3.1.0/gems/sass-embedded-1.55.0/ext/sass
G:/Devkits/Ruby31-x64/bin/ruby.exe -IG:/Devkits/Ruby31-x64/lib/ruby/3.1.0
-rrubygems G:/Devkits/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-10.0.4/bin/rake
RUBYARCHDIR\=G:/Devkits/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/sass-embedded-1.55.0
RUBYLIBDIR\=G:/Devkits/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/sass-embedded-1.55.0
fetch
https://github.com/sass/dart-sass-embedded/releases/download/1.55.0/sass_embedded-1.55.0-windows-x64.zip
powershell -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File
expand-archive.ps1 -Force -LiteralPath sass_embedded-1.55.0-windows-x64.zip
-DestinationPath . -PassThru
Expand-Archive : A parameter cannot be found that matches parameter name
'PassThru'.
At
G:\Devkits\Ruby31-x64\lib\ruby\gems\3.1.0\gems\sass-embedded-1.55.0\ext\sass\expand-archive.ps1:1      
char:16
+ Expand-Archive @args
+                ~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Expand-Archive],
ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Expand-Archive

rake aborted!
wrong number of arguments (given 2, expected 1)

Tasks: TOP => default => install => embedded.rb => sass_embedded
(See full trace by running task with --trace)

rake failed, exit code 1

It only happens on version 1.55.0 and above, traced to commit 0d103fd.

It seems that the stock version of PowerShell doesn't support the -PassThru parameter found here in the source code, as indicated by this StackOverflow thread.

Stock Windows PowerShell cannot be updated, a new version can only be installed separately. And I don't think there's a way for me to specify which version of powershell to use for the build process.

Rubygems is pointing on wrong version of library on Rocky 9

While I'm trying to install sass-embeded gem from rubygems on Rocky linux 9 it is fetching version for android, like this:

gem install sass-embedded
Fetching google-protobuf-3.25.3-x86_64-linux.gem
Successfully installed google-protobuf-3.25.3-x86_64-linux
Fetching sass-embedded-1.71.1-x86_64-linux-android.gem
Successfully installed sass-embedded-1.71.1-x86_64-linux-android
Parsing documentation for google-protobuf-3.25.3-x86_64-linux
Installing ri documentation for google-protobuf-3.25.3-x86_64-linux
Parsing documentation for sass-embedded-1.71.1-x86_64-linux-android
Installing ri documentation for sass-embedded-1.71.1-x86_64-linux-android
Done installing documentation for google-protobuf, sass-embedded after 1 seconds
2 gems installed

with bundler-2.5.6 it will fail completely:

Retrying download gem from https://rubygems.org/ due to error (2/4): Gem::RemoteFetcher::FetchError bad response Forbidden 403 (https://rubygems.org/gems/sass-embedded-1.70.0-x86_64-linux.gem)
Retrying download gem from https://rubygems.org/ due to error (3/4): Gem::RemoteFetcher::FetchError bad response Forbidden 403 (https://rubygems.org/gems/sass-embedded-1.70.0-x86_64-linux.gem)
Retrying download gem from https://rubygems.org/ due to error (4/4): Gem::RemoteFetcher::FetchError bad response Forbidden 403 (https://rubygems.org/gems/sass-embedded-1.70.0-x86_64-linux.gem)
Bundler::HTTPError: Could not download gem from https://rubygems.org/ due to
underlying error <bad response Forbidden 403
(https://rubygems.org/gems/sass-embedded-1.70.0-x86_64-linux.gem)>

/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/rubygems_integration.rb:459:in
`rescue in download_gem'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/rubygems_integration.rb:434:in
`download_gem'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/source/rubygems.rb:488:in
`download_gem'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/source/rubygems.rb:449:in
`fetch_gem'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/source/rubygems.rb:433:in
`fetch_gem_if_possible'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/source/rubygems.rb:162:in
`install'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/installer/gem_installer.rb:54:in
`install'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/installer/parallel_installer.rb:132:in
`do_install'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/worker.rb:62:in
`apply_func'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/worker.rb:57:in `block in
process_queue'
  /usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/worker.rb:54:in `loop'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/worker.rb:54:in
`process_queue'
/usr/local/share/gems/gems/bundler-2.5.6/lib/bundler/worker.rb:90:in `block (2
levels) in create_threads'

According version available on rubygems it should download https://rubygems.org/gems/sass-embedded-1.70.0-x86_64-linux-gnu.gem, instead of https://rubygems.org/gems/sass-embedded-1.70.0-x86_64-linux.gem. Isn't it?

Failed to install on Github Actions after bundle update from 1.5x to 1.62

After last bundle update and update sass-embedded and sassc-embedded in one of my projects as below, Github Actions is unable to install gem and CI is not working

# Gemfile.lock diff
-    sass-embedded (1.56.1)
+    sass-embedded (1.62.1)
      google-protobuf (~> 3.21)
      rake (>= 10.0.0)
-    sassc-embedded (1.54.0)
-      sass-embedded (~> 1.54)
+    sass-embedded (1.62.1-x86_64-darwin)
+      google-protobuf (~> 3.21)
+    sass-embedded (1.62.1-x86_64-linux-gnu)
+      google-protobuf (~> 3.21)
+    sassc-embedded (1.59.0)
+      sass-embedded (~> 1.59)
Your bundle is locked to sass-embedded (1.62.1-x86_64-linux) from rubygems
repository https://rubygems.org/ or installed locally, but that version can no
longer be found in that source. That means the author of sass-embedded

no matter if I bundle lock with platform x86_64-linux or x86_64-linux-gnu
but it looks like this version is available at rubygems (?!) https://rubygems.org/gems/sass-embedded/versions/1.62.1-x86_64-linux-gnu. Or is this some kind of mismatch between how Github defines the platform and how it is being released to rubygems (notice: linux vs linux-gnu)

Processes are leaking, elevated memory usage

Hi there,

We run sass-embedded on multiple servers and are noticing that the processes are leaking, causing containers to use a lot of RAM.

ELAPSED   RSS COMMAND         ARGS
 239640 29156 dart:sass.snaps /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.66.1-x86_64-linux-gnu/ext/sass/dart-sass/src/dart /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/
 239662 23176 dart:sass.snaps /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.66.1-x86_64-linux-gnu/ext/sass/dart-sass/src/dart /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/
 239663 22308 dart:sass.snaps /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.66.1-x86_64-linux-gnu/ext/sass/dart-sass/src/dart /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/
 223323 21092 dart:sass.snaps /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.66.1-x86_64-linux-gnu/ext/sass/dart-sass/src/dart /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/
 237514 20944 dart:sass.snaps /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.66.1-x86_64-linux-gnu/ext/sass/dart-sass/src/dart /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/
 239663 13060 dart:sass.snaps /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.66.1-x86_64-linux-gnu/ext/sass/dart-sass/src/dart /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/

On our servers, we've observed this behaviour with versions 1.66.1 and 1.69.2. I can also reproduce the issue locally with version 1.69.5:

  PID TTY           TIME CMD
81862 ttys000    0:00.63 /Users/pmusaraj/.gem/ruby/3.2.1/gems/sass-embedded-1.69.5-arm64-darwin/ext/sass/dart-sass/src/dart /Users/pmusaraj/.gem/ruby/3.2.1/gems/sass
81863 ttys000    0:00.64 /Users/pmusaraj/.gem/ruby/3.2.1/gems/sass-embedded-1.69.5-arm64-darwin/ext/sass/dart-sass/src/dart /Users/pmusaraj/.gem/ruby/3.2.1/gems/sass
81914 ttys000    0:00.13 /Users/pmusaraj/.gem/ruby/3.2.1/gems/sass-embedded-1.69.5-arm64-darwin/ext/sass/dart-sass/src/dart /Users/pmusaraj/.gem/ruby/3.2.1/gems/sass
image

In theory, should there be just one dart-sass process running?

sass-embedded installs x86_64-linux-gnu version and then fails on another machine

I'm frankly not sure if this is a Bundler issue or what but it only happens with sass-embedded.

When I add the gem to the Gemfile in Docker locally and then run bundle, it installs x86_64-linux-gnu version. It then fails on the CI with

Your bundle is locked to sass-embedded (1.55.0-x86_64-linux) from rubygems
repository https://rubygems.org/ or installed locally, but that version can no
longer be found in that source. That means the author of sass-embedded
(1.55.0-x86_64-linux) has removed it. You'll need to update your bundle to a
version other than sass-embedded (1.55.0-x86_64-linux) that hasn't been removed
in order to install.

The Gemfile.lock includes both version without the platform pin and with:

    sass-embedded (1.55.0)
      google-protobuf (~> 3.19)
      rake (>= 10.0.0)
    sass-embedded (1.55.0-x86_64-linux-gnu)
      google-protobuf (~> 3.19)

Removing the platform pin manually works and bundle no longer adds it until I update any of the gems, in which case it's getting re-added and the problem resurfaces.

I tried looking for a solution everywhere, searched through Bundler and RubyGems issues and I can't figure this one out. Is this a problem with how the gem is released or am I doing something wrong?

Support musl-libc

Dart has no official support for musl-libc.

However, it turns out the SDK can be in fact be built against musl-libc when not using tcmalloc. To provide the support we will have to build our own SDK and then build dart-sass-embedded.

Stay tuned!

Gem won't install on Windows 2019 Server Core with JRuby

Hi there - it seems the current approach for unzipping is not very portable across Windows systems due to the use of cscript/vbascript to unzip the binary.

It works fine on Windows 10/11, however on Windows 2019 Server Core (e.g container mcr.microsoft.com/windows/servercore:ltsc2019), it fails to install without any feedback.

fetch https://github.com/sass/dart-sass-embedded/releases/download/1.54.9/sass_embedded-1.54.9-windows-x64.zip
cscript unzip.vbs //B //Nologo sass_embedded-1.54.9-windows-x64.zip .
rake aborted!
sass_embedded/dart-sass-embedded not found

By removing the //B argument to cscript (suppresses all errors) you now get feedback on the failure:

fetch https://github.com/sass/dart-sass-embedded/releases/download/1.54.9/sass_embedded-1.54.9-windows-x64.zip
cscript unzip.vbs //Nologo sass_embedded-1.54.9-windows-x64.zip .
C:\go\pipelines\test\ext\sass\unzip.vbs(10, 1) (null): Unspecified error 

rake aborted!
sass_embedded/dart-sass-embedded not found
C:/go/pipelines/test/ext/sass/Rakefile:28:in `block in <top (required)>'
Tasks: TOP => default => install => embedded.rb
(See full trace by running task with --trace)
rm sass_embedded-1.54.9-windows-x64.zip

Line 10 is
https://github.com/ntkme/sass-embedded-host-ruby/blob/81177507031b58175dfd6e7ecc9f133a7d2303fb/ext/sass/unzip.vbs#L10

The reason this doesn't work is that the NameSpace logic here seems to rely upon some kind of Compressed Folders feature of the Windows shell/explorer that makes zips easy to work with. This feature is so old, that it seems difficult to find information about, but is hinted at here.

In addition, this method will NOT work if Compressed Folders is disabled. In that situation, you will get this message:
Path\to\script.vbs(line number, char number) (null): Unspecified error
It is simple to Google how to enable/disable Compressed Folders.

Maybe was simple to google in 2011, but not so much now? 😅 I am inferring that this is not enabled by default on server variants especially Core which omits many features of full fledged windows. These core variants are common to use to run as build agents (we use Windows 2019 Server Core containers to build). I'm not even sure how to enable whatever is needed when building a docker image to try and resolve this, but will keep playing around.

Would you consider going back to a more standard approach here, using Powershell 5? I don't have context on why it was replaced in 778c61a but it seems this would be more robust to me, rather than depending on weird Windows Shell options like Compressed Folders?

Weird Build Error on linux

Hey, I'm using Jekyll with sass-embedded and it's working fine on my MacBook, but I have this strange error on the CI server:

current directory: /home/circleci/repo/vendor/bundle/ruby/3.1.0/gems/sass-embedded-1.4.2/ext/sass
/usr/local/bin/ruby -I/usr/local/lib/ruby/3.1.0 -rrubygems /home/circleci/repo/vendor/bundle/ruby/3.1.0/gems/rake-12.3.3/exe/rake RUBYARCHDIR\=/home/circleci/repo/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/sass-embedded-1.4.2 RUBYLIBDIR\=/home/circleci/repo/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/sass-embedded-1.4.2
fetch https://github.com/sass/dart-sass-embedded/releases/download/1.50.0/sass_embedded-1.50.0-linux-x64.tar.gz
rake aborted!
ArgumentError: wrong number of arguments (given 2, expected 1)
/home/circleci/repo/vendor/bundle/ruby/3.1.0/gems/sass-embedded-1.4.2/ext/sass/Rakefile:57:in `unarchive'
/home/circleci/repo/vendor/bundle/ruby/3.1.0/gems/sass-embedded-1.4.2/ext/sass/Rakefile:20:in `block in <top (required)>'
/home/circleci/repo/vendor/bundle/ruby/3.1.0/gems/rake-12.3.3/exe/rake:27:in `<main>'
Tasks: TOP => default => install => sass_embedded
(See full trace by running task with --trace)

rake failed, exit code 1

But when I look at that line of code, it looks correct to me: mkdir_p dest.

Cannot install gem on debian:unstable

When I try to use a project that tries to install the gem via bundle, installation fails:

$ bundle install
Fetching gem metadata from https://rubygems.org/............
Resolving dependencies...
Fetching sass-embedded 1.69.5 (x86_64-linux)

Retrying download gem from https://rubygems.org/ due to error (2/4): Gem::RemoteFetcher::FetchError bad response Forbidden 403 (https://rubygems.org/gems/sass-embedded-1.69.5-x86_64-linux.gem)

Retrying download gem from https://rubygems.org/ due to error (3/4): Gem::RemoteFetcher::FetchError bad response Forbidden 403 (https://rubygems.org/gems/sass-embedded-1.69.5-x86_64-linux.gem)

Retrying download gem from https://rubygems.org/ due to error (4/4): Gem::RemoteFetcher::FetchError bad response Forbidden 403 (https://rubygems.org/gems/sass-embedded-1.69.5-x86_64-linux.gem)

This is probably not an issue with this project itself, but I hope the issue can be raised somewhere somehow. Or maybe a re-upload helps?

Time lag between google-protobuf ruby and maven protoc releases can cause install failures

Not sure there is much that can be done here, however at time of writing 3.21.6 has been pushed to RubyGems (and dependabot suggested an update) yet the same binaries for com.google.protobuf:protoc:3.21.6 has not been pushed to Maven Central here, causing installs to fail.

https://github.com/ntkme/sass-embedded-host-ruby/blob/b08a6fd547b0660ef2d9dd5133f3f173daf260ec/ext/sass/Rakefile#L245-L246

Feel free to close, since I imagine there is likely not much that can be done about it, but I was a little bit surprised naively to find the install time dependency on Maven Central :-)

Occasional installation failure

I first encountered this issue with a Jekyll plugin repository.
I then tried to reproduce this issue with a fork of sass-embedded-host-ruby. I was successful just once among many runs with the trace:

  Fetching sass-embedded 1.57.1
  Installing sass-embedded 1.57.1 with native extensions
  Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  
  current directory:
  /home/runner/work/sass-embedded/sass-embedded/vendor/bundle/ruby/3.0.0/gems/sass-embedded-1.57.1/ext/sass
  /opt/hostedtoolcache/Ruby/3.0.5/x64/bin/ruby
  -I/opt/hostedtoolcache/Ruby/3.0.5/x64/lib/ruby/3.0.0 -rrubygems
  /home/runner/work/sass-embedded/sass-embedded/vendor/bundle/ruby/3.0.0/gems/rake-10.5.0/bin/rake
  RUBYARCHDIR\=/home/runner/work/sass-embedded/sass-embedded/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/sass-embedded-1.57.1
  RUBYLIBDIR\=/home/runner/work/sass-embedded/sass-embedded/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/sass-embedded-1.57.1
  fetch
  https://github.com/sass/dart-sass-embedded/releases/download/1.57.1/sass_embedded-1.57.1-linux-x64.tar.gz
  rake aborted!
  ArgumentError: wrong number of arguments (given 2, expected 1)
  /home/runner/work/sass-embedded/sass-embedded/vendor/bundle/ruby/3.0.0/gems/sass-embedded-1.[57](https://github.com/ashmaroli/sass-embedded/actions/runs/3816688510/jobs/6492472257#step:3:63).1/ext/sass/Rakefile:102:in
  `unarchive'
  /home/runner/work/sass-embedded/sass-embedded/vendor/bundle/ruby/3.0.0/gems/sass-embedded-1.57.1/ext/sass/Rakefile:22:in
  `block in <top (required)>'
  Tasks: TOP => default => install => embedded.rb => sass_embedded
  (See full trace by running task with --trace)

The full run is here

Any idea what could be wrong?

How can I use sass-embedded with tilt?

Before version 1.2.0, we can use sass-embedded with Tilt by using some workaround such as follows:

module Tilt
  class SassTemplate < Template
    self.default_mime_type = "text/css"

    @@load_paths = []

    def self.load_paths
      @@load_paths
    end

    begin
      require "sass-embedded"
    rescue LoadError => err
      raise err
    end

    def prepare
      @render_result = Sass.compile_string(data, **sass_options)
    rescue => e
      puts "ERROR"
      p e.sass_message, e.sass_stack, e.span
    end

    def evaluate(scope, locals, &block)
      @output ||= @render_result.css
    end

    def allows_script?
      false
    end

    private

    def sass_options
      # options.merge(filename: eval_file, line: line, syntax: :indented)
      options.merge(load_paths: @@load_paths, syntax: :indented)#load_paths: [])
    end
  end

  class ScssTemplate < SassTemplate
    self.default_mime_type = "text/css"

    def sass_options
      options.merge(syntax: :scss)#load_paths: [])
    end
  end
end

The above code overwrites the original SassTemplate and ScssTemplate of Tilt.

However, the following exception occurs at here after version 1.2.0.

LoadError: cannot load such file -- sassc

How can I use sass-embedded with Tilt?

Unable to deploy on systems using x86_64-linux

Hi There,

I've recently pulled this library in as a dependency of jekyl and I'm having some issues with it on our platform. Specifically I can't see a build being made available for x86_64-linux, which causes the following problem for us whilst trying to run our pipelines:

Your bundle is locked to sass-embedded (1.68.0-x86_64-linux) from rubygems
repository https://rubygems.org/ or installed locally, but that version can no
longer be found in that source. That means the author of sass-embedded
(1.68.0-x86_64-linux) has removed it. You'll need to update your bundle to a
version other than sass-embedded (1.68.0-x86_64-linux) that hasn't been removed
in order to install.

I've attempted to add the 32 bit platform but that doesn't seem to help. Can we extend the release pipeline to target x86_64-linux also?

Unable to install sass-embedded gem due to missing protoc

Seems that the trick to grab the correct version of protoc from is currently broken as the latest version of google-protobuf gem is 3.24.4 but the latest available protobuf compiler is 3.24.3.

I assume this is outside of your hands and the situation will be resolved as soon as the Maven repository gets updated but it would be amazing if the error message was a bit more helpful as it took me a while to figure out why my bundle install suddenly crashes with:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/semaphore/h2/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.6.2/ext/sass
/home/semaphore/.rbenv/versions/3.2.2/bin/ruby -rrubygems
/home/semaphore/h2/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake
RUBYARCHDIR\=/home/semaphore/h2/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/sass-embedded-1.6.2
RUBYLIBDIR\=/home/semaphore/h2/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/sass-embedded-1.6.2
fetch
https://github.com/sass/dart-sass-embedded/releases/download/1.52.3/sass_embedded-1.52.3-linux-x64.tar.gz
tar -vxC . -f sass_embedded-1.52.3-linux-x64.tar.gz
mkdir -p .
sass_embedded/src/LICENSE
sass_embedded/dart-sass-embedded
rm sass_embedded-1.52.3-linux-x64.tar.gz
fetch https://github.com/sass/embedded-protocol/raw/1.0.0/embedded_sass.proto
fetch
https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.24.4/protoc-3.24.4-linux-x86_64.exe
rake aborted!
Gem::RemoteFetcher::FetchError: bad response Not Found 404
(https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.24.4/protoc-3.24.4-linux-x86_64.exe)
/home/semaphore/h2/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.6.2/ext/sass/Rakefile:108:in
`public_send'
/home/semaphore/h2/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.6.2/ext/sass/Rakefile:108:in
`fetch'
/home/semaphore/h2/vendor/bundle/ruby/3.2.0/gems/sass-embedded-1.6.2/ext/sass/Rakefile:14:in
`block in <top (required)>'
/home/semaphore/h2/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in
`<main>'
Tasks: TOP => default => install => embedded_sass_pb.rb => protoc.exe
(See full trace by running task with --trace)
rake failed, exit code 1

(it's not exactly obvious that this gem uses protobuf :))

Fails to install "jekyll" & "github-pages" with v1.63.1

Hi 👋

I am unable to install "jekyll" & "github-pages" gems after the release of v1.63.1, wondering if it's a regression in latest releases.

Error message 👇

"sass" from sass conflicts with installed executable from sass-embedded

  • Bundler version: v2.4.14
  • Ruby version: v3.2

Temporary workaround: gem install sass-embedded -v 1.62.1 followed by gem install jekyll github-pages works fine.

UndefinedConversionError "\xC3" from ASCII-8BIT to UTF-8 within JRuby/Rails/Sprockets dev mode

Hi there - similar to #2 after some change I can't trace, I have started getting a persistent failure of a particular stylesheet to compile dynamically in a dev environment. It seems to be fine when precompiling assets, and I can't quite trace what is different between the two setups.

Environment:
MacOS 12.6 Monterey
JRuby 9.3.8.0 under Java 17
rails 6.1.7
sprockets 4.1.1
sassc-embedded 1.54.0 installed per https://github.com/ntkme/sassc-embedded-shim-ruby

Possible problem
I am guessing from #2 that there is some default encoding problem somewhere, but I am not quite sure where to look as the code seems rather different than when #2 was discussed.

I tried forcing Java file.encoding=UTF-8 in case there is a JRuby default thing going on here, as well as forcing the default encodings at Rails level - seems no difference.

The issue seems to be with debug assets as changing to
config.assets.debug = false in application.rb (or for the specific problematic stylesheet's tag) seems to allow render to work, at least for this particular page.

# Fails
<%= stylesheet_link_tag "new-theme", {media: "all", debug: Rails.env.development? && params[:debug_assets]} %>

# Works OK
<%= stylesheet_link_tag "new-theme", {media: "all", debug: false} %>

Any workarounds or help to narrow the problem down would be appreciated.

Error Detail

The same top level SCSS asset (new-theme) fails to compile with

ActionView::Template::Error ("\xC3" from ASCII-8BIT to UTF-8):
    4: <%= yield :before_stylesheets %>
    5: <%= stylesheet_link_tag "application", {media: "all", debug: Rails.env.development? && params[:debug_assets]} %>
    6: <%= stylesheet_link_tag "patterns/application", {media: "all", debug: Rails.env.development? && params[:debug_assets]} %>
    7: <%= stylesheet_link_tag "new-theme", {media: "all", debug: Rails.env.development? && params[:debug_assets]} %>
    8:
    9: <%= javascript_include_tag "application", debug: Rails.env.development? && params[:debug_assets] %>
   10:

app/views/shared/_head.html.erb:7
app/views/layouts/pipelines.html.erb:4
app/controllers/stages_controller.rb:165:in `block in render_stage'
app/controllers/stages_controller.rb:164:in `render_stage'
app/controllers/stages_controller.rb:41:in `overview'

Full stack trace is

org/jruby/RubyString.java:6473:in `encode'
com/google/protobuf/jruby/RubyMessage.java:168:in `[]='
com/google/protobuf/jruby/RubyMessage.java:99:in `initialize'
org/jruby/RubyClass.java:890:in `new'
sass-embedded (1.55.0) lib/sass/embedded/host.rb:55:in `block in compile_request'
sass-embedded (1.55.0) lib/sass/embedded/host.rb:133:in `await'
sass-embedded (1.55.0) lib/sass/embedded/host.rb:43:in `compile_request'
sass-embedded (1.55.0) lib/sass/embedded.rb:209:in `compile_string'
sass-embedded (1.55.0) lib/sass/embedded.rb:47:in `compile_string'
sassc-embedded (1.54.0) lib/sassc/embedded.rb:17:in `render'
sassc-rails (2.1.2) lib/sassc/rails/template.rb:40:in `block in call'
sprockets (4.1.1) lib/sprockets/utils.rb:141:in `module_include'
sassc-rails (2.1.2) lib/sassc/rails/template.rb:39:in `call'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:84:in `call_processor'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:66:in `block in call_processors'
org/jruby/RubyArray.java:1947:in `reverse_each'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:65:in `call_processors'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:22:in `block in CompositeProcessor'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:33:in `call'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:84:in `call_processor'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:66:in `block in call_processors'
org/jruby/RubyArray.java:1947:in `reverse_each'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:65:in `call_processors'
sprockets (4.1.1) lib/sprockets/loader.rb:182:in `load_from_unloaded'
sprockets (4.1.1) lib/sprockets/loader.rb:59:in `block in load'
sprockets (4.1.1) lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
sprockets (4.1.1) lib/sprockets/loader.rb:43:in `load'
sprockets (4.1.1) lib/sprockets/cached_environment.rb:44:in `block in load'
org/jruby/RubyHash.java:1354:in `fetch'
sprockets (4.1.1) lib/sprockets/cached_environment.rb:44:in `load'
sprockets (4.1.1) lib/sprockets/add_source_map_comment_to_asset_processor.rb:48:in `call'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:84:in `call_processor'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:66:in `block in call_processors'
org/jruby/RubyArray.java:1947:in `reverse_each'
sprockets (4.1.1) lib/sprockets/processor_utils.rb:65:in `call_processors'
sprockets (4.1.1) lib/sprockets/loader.rb:182:in `load_from_unloaded'
sprockets (4.1.1) lib/sprockets/loader.rb:59:in `block in load'
sprockets (4.1.1) lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
sprockets (4.1.1) lib/sprockets/loader.rb:43:in `load'
sprockets (4.1.1) lib/sprockets/cached_environment.rb:44:in `block in load'
org/jruby/RubyHash.java:1354:in `fetch'
sprockets (4.1.1) lib/sprockets/cached_environment.rb:44:in `load'
sprockets (4.1.1) lib/sprockets/base.rb:81:in `find_asset'
sprockets (4.1.1) lib/sprockets/base.rb:119:in `[]'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:363:in `find_asset'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:348:in `find_debug_asset'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:230:in `block in lookup_debug_asset'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:243:in `block in resolve_asset'
org/jruby/RubyEnumerable.java:626:in `detect'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:242:in `resolve_asset'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:229:in `lookup_debug_asset'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:171:in `block in stylesheet_link_tag'
org/jruby/RubyArray.java:2667:in `map'
sprockets-rails (3.4.2) lib/sprockets/rails/helper.rb:170:in `stylesheet_link_tag'
org/jruby/RubyKernel.java:2003:in `public_send'
actionview (6.1.7) lib/action_view/base.rb:247:in `_run'
actionview (6.1.7) lib/action_view/template.rb:154:in `block in render'
activesupport (6.1.7) lib/active_support/notifications.rb:205:in `instrument'
actionview (6.1.7) lib/action_view/template.rb:345:in `instrument_render_template'
actionview (6.1.7) lib/action_view/template.rb:152:in `render'
actionview (6.1.7) lib/action_view/renderer/partial_renderer.rb:285:in `block in render_partial_template'
activesupport (6.1.7) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.7) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.7) lib/active_support/notifications.rb:203:in `instrument'
actionview (6.1.7) lib/action_view/renderer/partial_renderer.rb:280:in `render_partial_template'
actionview (6.1.7) lib/action_view/renderer/partial_renderer.rb:271:in `render'
actionview (6.1.7) lib/action_view/renderer/renderer.rb:81:in `render_partial_to_object'
actionview (6.1.7) lib/action_view/renderer/renderer.rb:27:in `render_to_object'
actionview (6.1.7) lib/action_view/renderer/renderer.rb:22:in `render'
actionview (6.1.7) lib/action_view/helpers/rendering_helper.rb:38:in `block in render'
actionview (6.1.7) lib/action_view/base.rb:273:in `in_rendering_context'
actionview (6.1.7) lib/action_view/helpers/rendering_helper.rb:34:in `render'
org/jruby/RubyKernel.java:2003:in `public_send'
actionview (6.1.7) lib/action_view/base.rb:247:in `_run'
actionview (6.1.7) lib/action_view/template.rb:154:in `block in render'
activesupport (6.1.7) lib/active_support/notifications.rb:205:in `instrument'
actionview (6.1.7) lib/action_view/template.rb:345:in `instrument_render_template'
actionview (6.1.7) lib/action_view/template.rb:152:in `render'
actionview (6.1.7) lib/action_view/renderer/template_renderer.rb:72:in `block in render_with_layout'
activesupport (6.1.7) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.7) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.7) lib/active_support/notifications.rb:203:in `instrument'
actionview (6.1.7) lib/action_view/renderer/template_renderer.rb:70:in `render_with_layout'
actionview (6.1.7) lib/action_view/renderer/template_renderer.rb:55:in `render_template'
actionview (6.1.7) lib/action_view/renderer/template_renderer.rb:11:in `render'
actionview (6.1.7) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
actionview (6.1.7) lib/action_view/renderer/renderer.rb:29:in `render_to_object'
actionview (6.1.7) lib/action_view/rendering.rb:117:in `block in _render_template'
actionview (6.1.7) lib/action_view/base.rb:273:in `in_rendering_context'
actionview (6.1.7) lib/action_view/rendering.rb:116:in `_render_template'
actionpack (6.1.7) lib/action_controller/metal/streaming.rb:218:in `_render_template'
actionview (6.1.7) lib/action_view/rendering.rb:103:in `render_to_body'
actionpack (6.1.7) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (6.1.7) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
actionpack (6.1.7) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (6.1.7) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (6.1.7) lib/action_controller/metal/instrumentation.rb:46:in `block in render'
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/benchmark.rb:308:in `realtime'
activesupport (6.1.7) lib/active_support/core_ext/benchmark.rb:14:in `ms'
actionpack (6.1.7) lib/action_controller/metal/instrumentation.rb:46:in `block in render'
actionpack (6.1.7) lib/action_controller/metal/instrumentation.rb:86:in `cleanup_view_runtime'
actionpack (6.1.7) lib/action_controller/metal/instrumentation.rb:45:in `render'
actionpack (6.1.7) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
actionpack (6.1.7) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.7) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.7) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.7) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.7) lib/active_support/callbacks.rb:106:in `run_callbacks'
actionpack (6.1.7) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.7) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.7) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.7) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.7) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.7) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.7) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.7) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
actionpack (6.1.7) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.7) lib/action_view/rendering.rb:39:in `process'
actionpack (6.1.7) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.7) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.7) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.7) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.7) lib/action_dispatch/journey/router.rb:50:in `block in serve'
org/jruby/RubyArray.java:1865:in `each'
actionpack (6.1.7) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.7) lib/action_dispatch/routing/route_set.rb:842:in `call'
rack (2.2.4) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.4) lib/rack/etag.rb:27:in `call'
rack (2.2.4) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.4) lib/rack/head.rb:12:in `call'
actionpack (6.1.7) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
actionpack (6.1.7) lib/action_dispatch/http/content_security_policy.rb:19:in `call'
uri:classloader:/jruby/rack/session_store.rb:79:in `context'
rack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.7) lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack (6.1.7) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.7) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.7) lib/action_dispatch/middleware/callbacks.rb:26:in `call' 

Broken gemspec for sass-embedded-1.77.0-x86_64

As of today with the release of 1.77.0 I get the following failure in my Gitlab pipeline:

bundler: failed to load command: jekyll (/usr/local/bundle/bin/jekyll)
/usr/local/bundle/gems/sass-embedded-1.77.0-x86_64-linux/ext/sass/cli.rb:16:in `<top (required)>': The gemspec for sass-embedded at /usr/local/bundle/specifications/sass-embedded-1.77.0-x86_64-linux.gemspec was broken.
(gitlab-runner 16.11.0, docker image ruby:3.1.2 with jekyll 4.3.3)

In my local installation I have no trouble with sass-embedded-1.77.0-arm64-darwin.

By adding gem 'sass-embedded', '> 1.54', '< 1.77' to my Gemfile, I'm able to workaround this problem by having the pipeline use the previous version of sass-embedded.

Thanks for your work on this important gem!

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.