Skip to content

Commit

Permalink
Prepare for rsass 0.26.
Browse files Browse the repository at this point in the history
MRSV is now 1.56.1.
  • Loading branch information
kaj committed Aug 27, 2022
1 parent 57570cc commit 9a5134b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -12,9 +12,8 @@ jobs:
matrix:
rust:
- stable
- 1.52.1
- 1.48.0
- 1.46.0
- 1.60.0
- 1.56.1
- beta
- nightly
steps:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -29,7 +29,7 @@ itertools = "0.10.0"
md5 = "0.7"
nom = "7.1.0"

rsass = { version = "0.25.0", optional = true }
rsass = { git = "https://github.com/kaj/rsass", optional = true }
mime = { version = "0.3", optional = true }

[badges]
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Expand Up @@ -455,20 +455,20 @@ impl Error for RucteError {
}

impl Display for RucteError {
fn fmt(&self, out: &mut fmt::Formatter) -> fmt::Result {
write!(out, "Error: {:?}", self)
}
}
impl Debug for RucteError {
fn fmt(&self, out: &mut fmt::Formatter) -> fmt::Result {
match self {
RucteError::Io(err) => Display::fmt(err, out),
RucteError::Env(var, err) => write!(out, "{:?}: {}", var, err),
#[cfg(feature = "sass")]
RucteError::Sass(err) => Display::fmt(err, out),
RucteError::Sass(err) => Debug::fmt(err, out),
}
}
}
impl Debug for RucteError {
fn fmt(&self, out: &mut fmt::Formatter) -> fmt::Result {
Display::fmt(self, out)
}
}

impl From<io::Error> for RucteError {
fn from(e: io::Error) -> RucteError {
Expand Down
19 changes: 9 additions & 10 deletions src/staticfiles.rs
Expand Up @@ -469,22 +469,22 @@ impl StaticFile {
{
let src = self.path_for(src);
use rsass::css::CssString;
use rsass::input::CargoContext;
use rsass::output::{Format, Style};
use rsass::sass::FormalArgs;
use rsass::sass::{CallError, FormalArgs};
use rsass::value::Quotes;
use rsass::*;
use std::sync::Arc;
let format = Format {
style: Style::Compressed,
precision: 4,
};
let scope = ScopeRef::new_global(format);

// TODO Find any referenced files!
println!("cargo:rerun-if-changed={}", src.display());

let (context, scss) =
CargoContext::for_path(&src).map_err(rsass::Error::from)?;
let mut context = context.with_format(format);
let existing_statics = Arc::new(self.get_names().clone());
scope.define_function(
context.get_scope().define_function(
"static_name".into(),
sass::Function::builtin(
"",
Expand All @@ -503,12 +503,12 @@ impl StaticFile {
.into());
}
}
Err(Error::S(format!(
Err(CallError::msg(format!(
"Static file {} not found",
name,
)))
}
name => Err(Error::BadArgument(
name => Err(CallError::BadArgument(
"name".into(),
format!(
"{} is not a string",
Expand All @@ -519,8 +519,7 @@ impl StaticFile {
),
);

let (file_context, scss) = FsFileContext::for_path(&src)?;
let css = format.write_root(scss.parse()?, scope, &file_context)?;
let css = context.transform(scss)?;
self.add_file_data(&src.with_extension("css"), &css)
}

Expand Down

0 comments on commit 9a5134b

Please sign in to comment.