Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart SASS, because ruby sass is deprecated #491

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
- name: Cache install Nix packages
uses: rikhuijzer/cache-install@249745afd54c8e2be0eb99aa6032b52629239b48
with:
key: nix-${{ hashFiles('packages.nix') }}
nix_file: 'packages.nix'
key: nix-${{ hashFiles('nix/*.nix') }}
nix_file: 'nix/packages.nix'
- name: Set environment variable
run: "export LANG=en_US.UTF-8"
- name: Build site
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- name: Cache install Nix packages
uses: rikhuijzer/cache-install@249745afd54c8e2be0eb99aa6032b52629239b48
with:
key: nix-${{ hashFiles('packages.nix') }}
nix_file: 'packages.nix'
key: nix-${{ hashFiles('nix/*.nix') }}
nix_file: 'nix/packages.nix'
- name: Set environment variable
run: "export LANG=en_US.UTF-8"
- name: Build site
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ gem 'kramdown'
# Kramdown math mode gems
gem 'kramdown-math-katex'

gem 'sassc'
gem 'typogruby'

# Needed for atom_feed in blogging helper
Expand Down
13 changes: 5 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ GEM
http_parser.rb (0.6.0)
icalendar (2.7.1)
ice_cube (~> 0.16)
ice_cube (0.16.3)
json (2.6.0)
ice_cube (0.16.4)
json (2.6.1)
json_schema (0.21.0)
katex (0.8.0)
execjs (~> 2.7)
Expand Down Expand Up @@ -124,7 +124,7 @@ GEM
public_suffix (4.0.6)
puma (5.5.2)
nio4r (~> 2.0)
racc (1.5.2)
racc (1.6.0)
rack (2.2.3)
rack-livereload (0.3.17)
rack
Expand All @@ -135,8 +135,6 @@ GEM
ref (2.0.0)
rexml (3.2.5)
rubypants (0.7.1)
sassc (2.4.0)
ffi (~> 1.9)
shellany (0.0.1)
slow_enumerator_tools (1.1.0)
terminal-notifier (2.0.0)
Expand All @@ -159,7 +157,7 @@ GEM
rexml (~> 3.2)
words_counted (1.0.3)
yui-compressor (0.12.0)
zeitwerk (2.4.2)
zeitwerk (2.5.1)

PLATFORMS
ruby
Expand All @@ -179,7 +177,6 @@ DEPENDENCIES
pandoc-ruby
puma
rainpress
sassc
terminal-notifier
terminal-notifier-guard
typogruby
Expand All @@ -190,4 +187,4 @@ DEPENDENCIES
yui-compressor

BUNDLED WITH
2.2.3
2.1.4
9 changes: 1 addition & 8 deletions Rules
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,7 @@ ignore '/assets/stylesheets/includes/**/*'
compile '/assets/stylesheets/**/*.scss' do
# This filter is necessary for the workaround present in main.scss and deals with out of date dependencies
filter :erb

sass_opts = {
syntax: :scss,
load_paths: ['content/assets/stylesheets']
}
sass_opts[:style] = :compressed if production?
filter :sassc, sass_opts

filter :dart_sass
filter :autoprefixer if production?
write ext: 'css'
end
Expand Down
27 changes: 8 additions & 19 deletions gemset.nix
Original file line number Diff line number Diff line change
Expand Up @@ -274,20 +274,20 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1rzfydzgy6jppqvzzr76skfk07nmlszpcjzzn4wlzpsgmagmf0wq";
sha256 = "1dri4mcya1fwzrr9nzic8hj1jr28a2szjag63f9k7p2bw9fpw4fs";
type = "gem";
};
version = "0.16.3";
version = "0.16.4";
};
json = {
groups = ["default" "test"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0a7p95md8j8lbgxx9dzygysxmrg1s80895f46f1y47k9kq9q56ry";
sha256 = "1z9grvjyfz16ag55hg522d3q4dh07hf391sf9s96npc0vfi85xkz";
type = "gem";
};
version = "2.6.0";
version = "2.6.1";
};
json_schema = {
groups = ["default" "development" "nanoc"];
Expand Down Expand Up @@ -549,10 +549,10 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "178k7r0xn689spviqzhvazzvxfq6fyjldxb3ywjbgipbfi4s8j1g";
sha256 = "0la56m0z26j3mfn1a9lf2l03qx1xifanndf9p3vx1azf6sqy7v9d";
type = "gem";
};
version = "1.5.2";
version = "1.6.0";
};
rack = {
groups = ["default" "development"];
Expand Down Expand Up @@ -636,17 +636,6 @@
};
version = "0.7.1";
};
sassc = {
dependencies = ["ffi"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0gpqv48xhl8mb8qqhcifcp0pixn206a7imc07g48armklfqa4q2c";
type = "gem";
};
version = "2.4.0";
};
shellany = {
groups = ["default" "nanoc"];
platforms = [];
Expand Down Expand Up @@ -807,9 +796,9 @@
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1746czsjarixq0x05f7p3hpzi38ldg6wxnxxw74kbjzh1sdjgmpl";
sha256 = "18l4r6layck0d80ydc692mv1lxak5xbf6w2paj1x7m2ggbggzxgj";
type = "gem";
};
version = "2.4.2";
version = "2.5.1";
};
}
5 changes: 5 additions & 0 deletions lib/filters/dart_sass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Nanoc::Filter.define(:dart_sass) do |_content, _params|
result = `sass -I. content/#{@item.identifier} --style compressed`
raise "Dart-sass has failed" unless $?.success?
result
end
4 changes: 0 additions & 4 deletions lib/filters/sassc.rb

This file was deleted.

31 changes: 31 additions & 0 deletions nix/dart-sass.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ pkgs ? (import (builtins.fetchTarball {
# Descriptive name to make the store path easier to identify
name = "nixos-unstable-2021-11-02";
# Commit hash for nixos-unstable as of 2018-09-12
url = "https://github.com/nixos/nixpkgs/archive/1380230a378043ecd55c3d50a0bfa1f401d80efc.tar.gz";
# Hash obtained using `nix-prefetch-url --unpack <url>`
sha256 = "062ix9661gq7ysgs4a2wppspvxdn2wcaf0l2pfiwpg8jkl3rgfnb";
}) {})
, sha256 ? "0d8ks6x4a32v906p0xb5nn0hkivyi6gr6nyiq10sz1zxx8gkcl7v"
, version ? "1.43.4" }:
with pkgs;
stdenv.mkDerivation {
name = "dart-sass-${version}";
inherit version;

src = fetchurl {
inherit sha256;
url = "https://github.com/sass/dart-sass/archive/${version}.tar.gz";
};

buildPhase = ''
export PUB_CACHE=$PWD/.pub-cache
export PUB_ENVIRONMENT=nix:install
${dart}/bin/dart pub get
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently a problem, unless we disable sandboxing in nix, this will never succeed as network requests are not allowed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to enable network requests anyways (for the WiNA announcement scren feature), so that's fine

${dart}/bin/dart compile exe -Dversion=${version} bin/sass.dart -o sass
'';
installPhase = ''
cp -r . $out
ln -s $out/sass $out/bin/sass
'';
}
4 changes: 2 additions & 2 deletions packages.nix → nix/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ let
gems = pkgs.bundlerEnv {
name = "zeus.ugent.be";
inherit ruby;
gemdir = ./.;
gemdir = ../.;
};
in with pkgs;
[
gems libxml2 nodejs yarn cacert git glibcLocales
gems libxml2 nodejs yarn cacert git glibcLocales (import ./dart-sass.nix {})
pandoc (texlive.combine { inherit (texlive) scheme-basic xetex unicode-math enumitem booktabs ulem; })
] ++ (if stdenv.isDarwin then [terminal-notifier] else [])
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let
build-deps = import ./packages.nix;
build-deps = import ./nix/packages.nix;
rev = "70904d4a9927a4d6e05c72c4aaac4370e05107f3";
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
pkgs = import nixpkgs {};
Expand Down