Skip to content
This repository was archived by the owner on May 15, 2023. It is now read-only.
This repository was archived by the owner on May 15, 2023. It is now read-only.

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

@ntkme

Description

@ntkme

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions