代码之家  ›  专栏  ›  技术社区  ›  Jasper de Vries nndru

如何在Linux上使用Sass 1.14和NetBeans 8.2

  •  1
  • Jasper de Vries nndru  · 技术社区  · 7 年前

    我曾经能够在netbeans8上安装和使用Sass,如上面的答案所述 How to use SASS with Netbeans 8.0.1

    现在,对于当前版本的Sass(1.14.1),安装是不同的。基本上只是下载和解压。完成了,我已经将NetBeans指向了正确的位置。但当前版本的Sass无法从NetBeans正确运行:

    "/opt/dart-sass/sass" "--cache-location" 
    "/home/jasper/.cache/netbeans/8.2/sass-compiler"
    "path_to_my.scss" "path_to_my.css"
    Could not find an option named "cache-location".
    

    此错误也包含在 Sass output error in Netbeans 8.2 他们使用Windows的地方。

    sass

    exec "$path/src/dart" --no-preview-dart-2 "-Dversion=1.14.1" "$path/src/sass.dart.snapshot" "$@"
    

    有人知道如何让sass1.14.1在Linux(Ubuntu)上从netbeans8.2运行吗?

    1 回复  |  直到 6 年前
        1
  •  1
  •   Jasper de Vries nndru    5 年前

    问题是 --cache-location 不再支持,应删除。所有原始参数都由 "$@" . 要删除前两个参数,您应该能够使用 "${@:3}" (见 Process all arguments except the first one (in a bash script) ),但不知怎的,这导致了一个“糟糕的替代”错误。所以我选择了 shift 2 要删除它们:

    #!/bin/sh
    # Copyright 2016 Google Inc. Use of this source code is governed by an MIT-style
    # license that can be found in the LICENSE file or at
    # https://opensource.org/licenses/MIT.
    
    # This script drives the standalone Sass package, which bundles together a Dart
    # executable and a snapshot of Sass. It can be created with `pub run grinder
    # package`.
    
    follow_links() {
      file="$1"
      while [ -h "$file" ]; do
        # On Mac OS, readlink -f doesn't work.
        file="$(readlink "$file")"
      done
      echo "$file"
    }
    
    # Unlike $0, $BASH_SOURCE points to the absolute path of this file.
    path=`dirname "$(follow_links "$0")"`
    shift 2
    exec "$path/src/dart" --no-preview-dart-2 "-Dversion=1.14.1" "$path/src/sass.dart.snapshot" "${@}"
    

    macOS(自制)

    如果您正在查找Dart Sass的安装位置(使用自制软件安装后),它位于以下位置:

    /usr/local/Cellar/sass/{version}/bin
    

    使用node.js时,会遇到 "env: node: No such file or directory" 问题。

    chmod a+x )):

    /usr/local/lib/node_modules/sass/sass_nb.sh
    

    并补充道:

    #!/bin/zsh
    
    export PATH="$PATH:"/usr/local/bin/
    shift 3
    sass ${@}
    

    上网本11+

    在netbeans11和12上,我必须使用 shift 3 而不是 班次2 .

        2
  •  0
  •   Alex    6 年前

    我的回答主要基于贾斯珀·德弗里斯的一句话:

    在我的例子中,Netbeans发出的完整命令是:

    “/home/alex/tools/dart sass/sass”“--缓存位置”“/home/alex/snap/netbeans/common/cache/12.0/sass编译器”“--调试信息”“/home/alex/projects/alexgheorghiu.com/web/aaa.scss”“/home/alex/projects/alexgheorghiu.com/web/aaa.css”

    所以前3个参数

    必须“删除”或忽略。

    所以你要么改变 萨斯 归档或复制(最安全的方式) 并添加

    shift 3
    

    说明。

    如果你从原始版本开始,比如:

    #!/bin/sh
    
    # This script drives the standalone dart-sass package, which bundles together a
    # Dart executable and a snapshot of dart-sass.
    
    follow_links() {
      file="$1"
      while [ -h "$file" ]; do
        # On Mac OS, readlink -f doesn't work.
        file="$(readlink "$file")"
      done
      echo "$file"
    }
    
    # Unlike $0, $BASH_SOURCE points to the absolute path of this file.
    path=`dirname "$(follow_links "$0")"`
    exec "$path/src/dart" "$path/src/sass.snapshot" "$@"
    

    你需要得到这样的结果:

    #!/bin/sh
    
    # This script drives the standalone dart-sass package, which bundles together a
    # Dart executable and a snapshot of dart-sass.
    
    follow_links() {
      file="$1"
      while [ -h "$file" ]; do
        # On Mac OS, readlink -f doesn't work.
        file="$(readlink "$file")"
      done
      echo "$file"
    }
    
    # Unlike $0, $BASH_SOURCE points to the absolute path of this file.
    path=`dirname "$(follow_links "$0")"`
    shift 3
    exec "$path/src/dart" "$path/src/sass.snapshot" "$@"
    

    一个有趣的方面是,Netbeans开发人员知道这个bug(请参阅: Could not find an option named "cache-location"

    推荐文章