如何在Linux/macOS上将Sass与NetBeans结合使用 [英] How to use Sass with NetBeans on Linux / macOS

查看:102
本文介绍了如何在Linux/macOS上将Sass与NetBeans结合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经能够按照NetBeans 8安装和使用Sass,如

I used to be able to install and use Sass with NetBeans 8 as described in the top answer on How to use SASS with Netbeans 8.0.1

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

Now, with the current version of Sass (1.14.1), installing is different. Basically just download and untar. That's done and I've pointed NetBeans to the correct location. But this current version of Sass won't run correctly from 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".

Netbeans 8.2中的ass输出错误也覆盖了此错误他们使用Windows的地方.

This error is also covered by Sass output error in Netbeans 8.2 where they are using Windows.

我试图将缓存位置参数(类似于Windows的解决方案)添加到sass文件中的此行:

I tried to add the cache location parameter (similar to the solution for Windows) to this line in the sass file:

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

但我无法使其正常运行(相同的错误不断出现).

but I could not get it working (same error keeps appearing).

关于在Linux(Ubuntu)上如何从NetBeans 8.2中获取Sass 1.14.1的任何想法?

Anybody any ideas on how to get Sass 1.14.1 working from NetBeans 8.2 on Linux (Ubuntu)?

推荐答案

问题是--cache-location不再受支持,应将其删除. "$@"使用所有原始参数.要删除前两个参数,您应该可以使用"${@:3}"(请参阅shift 2删除它们:

The issue is that --cache-location is no longer supported and should be removed. All of the original parameters are used by "$@". To remove the first two parameters, you should be able to use "${@:3}" (see Process all arguments except the first one (in a bash script)), but somehow that resulted into a "Bad substitution" error for me. So I opted to use shift 2 to remove them:

#!/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" "${@}"

确保保留原始文件并创建一个仅用于NetBeans的副本,然后在其中进行更改.

Make sure to keep the original file and create a copy to only be used with NetBeans and make the change there.

如果要查找Dart Sass的安装位置(使用Home Brew安装后),则位于此处:

If you are looking for the Dart Sass install location (after installing it with Home Brew), it is located here:

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

NetBeans 11

在NetBeans 11上,我必须使用shift 3而不是shift 2.

这篇关于如何在Linux/macOS上将Sass与NetBeans结合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆