Added sass
authoradithyasunil26 <adithyasunil26@gmail.com>
Fri, 5 Feb 2021 09:35:05 +0000 (13:35 +0400)
committeradithyasunil26 <adithyasunil26@gmail.com>
Fri, 5 Feb 2021 09:35:05 +0000 (13:35 +0400)
dart-sass/README.md [new file with mode: 0644]
dart-sass/install.ps1 [new file with mode: 0644]
dart-sass/install.sh [new file with mode: 0644]
dart-sass/releases.js [new file with mode: 0644]

diff --git a/dart-sass/README.md b/dart-sass/README.md
new file mode 100644 (file)
index 0000000..1c1f74b
--- /dev/null
@@ -0,0 +1,33 @@
+---
+title: dart-sass
+homepage: https://github.com/webinstall/dart-sass
+tagline: |
+  dart-sass: A Dart implementation of Sass. Sass makes CSS fun again.
+---
+
+To update or switch versions, run `webi example@dart-sass` (or `@v2`, `@beta`,
+etc).
+
+## Cheat Sheet
+
+> Dart Sass has replaced Ruby Sass as the canonical implementation of the Sass language.
+
+### Command format:
+```bash
+sass <input.scss> [output.css]
+```
+or
+```bash
+sass <input.scss>:<output.css> <input/>:<output/> <dir/>
+```
+
+
+| Input and Output             | Functionality                                             |
+|------------------|-----------------------------------------------------------|
+| --[no-]stdin     | Read the stylesheet from stdin.                           |
+| --[no-]indented  | Use the indented syntax for input from stdin.             |
+| -I, --load-path= | A path to use when resolving imports.                     |
+| -s, --style=     | Output style.                                             |
+| --[no-]charset   | Emit a @charset or BOM for CSS with non-ASCII characters. |
+| --[no-]error-css | When an error occurs, emit a stylesheet describing it.    |
+| --update         | Only compile out-of-date stylesheets.                     |
\ No newline at end of file
diff --git a/dart-sass/install.ps1 b/dart-sass/install.ps1
new file mode 100644 (file)
index 0000000..434eede
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/env pwsh
+
+##################
+# Install dart-sass #
+##################
+
+$pkg_cmd_name = "dart-sass"
+
+$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\dart-sass.exe"
+$pkg_dst = "$pkg_dst_cmd"
+
+$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\dart-sass-v$Env:WEBI_VERSION\bin\dart-sass.exe"
+$pkg_src_bin = "$Env:USERPROFILE\.local\opt\dart-sass-v$Env:WEBI_VERSION\bin"
+$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dart-sass-v$Env:WEBI_VERSION"
+$pkg_src = "$pkg_src_cmd"
+
+$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
+
+IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
+{
+    # TODO: arch detection
+    echo "Downloading dart-sass from $Env:WEBI_PKG_URL to $pkg_download"
+    & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
+    & move "$pkg_download.part" "$pkg_download"
+}
+
+IF (!(Test-Path -Path "$pkg_src_cmd"))
+{
+    echo "Installing dart-sass"
+
+    pushd .local\tmp
+
+        # Remove any leftover tmp cruft
+        Remove-Item -Path ".\dart-sass-v*" -Recurse -ErrorAction Ignore
+        Remove-Item -Path ".\dart-sass.exe" -Recurse -ErrorAction Ignore
+
+        echo "Unpacking $pkg_download"
+        & tar xf "$pkg_download"
+
+        echo "Install Location: $pkg_src_cmd"
+        New-Item "$pkg_src_bin" -ItemType Directory -Force
+        Move-Item -Path ".\dart-sass-*\dart-sass.exe" -Destination "$pkg_src_bin"
+
+    # Exit tmp
+    popd
+}
+
+echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
+Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore
+Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
diff --git a/dart-sass/install.sh b/dart-sass/install.sh
new file mode 100644 (file)
index 0000000..b341521
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+function __init_dart-sass() {
+    set -e
+    set -u
+
+    ##################
+    # Install dart-sass #
+    ##################
+
+    pkg_cmd_name="dart-sass"
+
+    pkg_dst_cmd="$HOME/.local/bin/dart-sass"
+    pkg_dst="$pkg_dst_cmd"
+
+    pkg_src_cmd="$HOME/.local/opt/dart-sass-v$WEBI_VERSION/bin/dart-sass"
+    pkg_src_dir="$HOME/.local/opt/dart-sass-v$WEBI_VERSION"
+    pkg_src="$pkg_src_cmd"
+
+    # pkg_install must be defined by every package
+    pkg_install() {
+        mkdir -p "$(dirname $pkg_src_cmd)"
+        mv ./dart-sass-*/dart-sass "$pkg_src_cmd"
+        pathman add ~/.local/bin/dart-sass
+    }
+
+    pkg_get_current_version() {
+        echo $(dart-sass --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2)
+    }
+
+}
+
+__init_dart-sass
diff --git a/dart-sass/releases.js b/dart-sass/releases.js
new file mode 100644 (file)
index 0000000..da440a9
--- /dev/null
@@ -0,0 +1,20 @@
+'use strict';
+
+var github = require('../_common/github.js');
+var owner = 'sass';
+var repo = 'dart-sass';
+
+module.exports = function (request) {
+  return github(request, owner, repo).then(function (all) {
+    return all;
+  });
+};
+
+if (module === require.main) {
+  module.exports(require('@root/request')).then(function (all) {
+    all = require('../_webi/normalize.js')(all);
+    // just select the first 5 for demonstration
+    all.releases = all.releases.slice(0, 5);
+    console.info(JSON.stringify(all, null, 2));
+  });
+}