Bug 247890 - SASS preprocessor does not support libsass/sassc
SASS preprocessor does not support libsass/sassc
Status: VERIFIED FIXED
Product: web
Classification: Unclassified
Component: CSS Preprocessors (SASS, LESS, ...)
8.2
PC Linux
: P3 with 2 votes (vote)
: 8.2
Assigned To: Tomas Mysik
Vladimir Riha
:
: 256020 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-13 11:06 UTC by seventyeight
Modified: 2017-07-19 09:04 UTC (History)
8 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description seventyeight 2014-10-13 11:06:40 UTC
In css.prep/src/org/netbeans/modules/css/prep/sass/SassExecutable.java ist a hardcoded parameter "--cache-location", which is always added to the execute commandline. This does not work with libsass/sassc. This parameter is unknown and leads to an error. It should be optional, so other implementations of SASS can be used. The other parameters as well. Maybe you can write these in the compiler options input field as default, hence it is editable.
Comment 1 Tomas Mysik 2014-10-13 11:14:53 UTC
Taking over. Not a defect, it works as expected. Please, provide exact steps to reproduce your issue (what we need to do to investigate your issue). Thanks.
Comment 2 seventyeight 2014-10-13 11:31:35 UTC
You will need: http://libsass.org and https://github.com/sass/sassc
On OSX you can install it via brew. 
I edited in Settings > Miscellaneous >CSS Preprocessors the Sass path to my SassC executable. i.e.: /usr/local/bin/sassc

In my project properties in CSS Preprocessors i checked "compile sas files on save".

On save the output comes up: "/usr/local/bin/sassc" "--cache-location" "/Users/seventyeight/Library/Caches/NetBeans/8.0/sass-compiler" ...

SassC does not know this argument "--cache-location" and hence it leads to an error: 
/usr/local/bin/sassc: illegal option -- -
Comment 3 Tomas Mysik 2014-10-13 11:34:32 UTC
Fine. Please provide how the command line (all the parameters) should look like in your case. Thanks.
Comment 4 seventyeight 2014-10-13 11:42:14 UTC
Simplest example would be: "sassc -o css/myoutput.css scss/myinput.scss" or via pipe: "sassc scss/myinput.scss > css/myoutput.css"
Comment 5 Tomas Mysik 2014-10-13 11:53:06 UTC
We will evaluate it and add support for it if it can work as expected for us.

Thanks.
Comment 6 mbicknese 2014-10-16 09:58:01 UTC
Same problem with node-sass, which uses libsass in the background.

I tried making a little batch proxy script, stripping the cache parameter. I got no error but Netbeans keeps waiting for the script to finish. The SCSS did not get compiled either.
Comment 7 Daniel84 2014-11-13 12:03:14 UTC
Same problem with Linux and current sassc + libsass version
The --cache-location needs to be removed

Usage for sassc:
<code>
Usage: sassc [options] [INPUT] [OUTPUT]

Options:
   -s, --stdin             Read input from standard input instead of an input file.
   -t, --style NAME        Output style. Can be: nested, compressed.
   -l, --line-numbers      Emit comments showing original line numbers.
       --line-comments
   -I, --load-path PATH    Set Sass import path.
   -m, --sourcemap         Emit source map.
   -M, --omit-map-comment  Omits the source map url comment.
   -p, --precision         Set the precision for numbers.
   -h, --help              Display this help message.

</code>

Current Netbeans call:
<code>
"/usr/bin/sassc" "--cache-location" "/home/username/.cache/netbeans/8.0/sass-compiler" "/pathtoscss/style/onepage.scss" "/pathtoscss/style/onepage.css"
</code>

Should be
<code>
"/usr/bin/sassc" "/pathtoscss/style/onepage.scss" "/pathtoscss/style/onepage.css"
</code>

Here's a little Proxy Script which strips the not needed params to use as workaround in the meantime.
Put this file somewhere and put the path in the netbeans sass path config option.
You may have to change the path for you sassc executable
<code>
#!/bin/bash
echo "SassC Proxy"

if [ $1 == "--version" ]; then
  echo "Sassc Proxy v1"
elif [ -n $3 ] && [ -n $4 ]; then
  echo "Running: sassc $3 $4"
  /usr/bin/sassc $3 $4
  echo Finished
else
  echo "Params wrong: $*"
  exit 1
fi
exit 0
</code>

PS: Netbeans calls for some reason "sasscmd --version" as first step, so make sure you handle that call if you do your own workaround script
Comment 8 ekubovsky 2015-06-02 23:42:18 UTC
Hi!

This would be problem with any Sass executable that is not original sass or sass.bat

I tried to use 'C:\Ruby193\bin\compass.bat' and it gave me the same error.

'--cache-location' should be a configurable option, not a hard-coded parameter.

Thank you in advance!
Comment 9 Tomas Mysik 2015-06-03 05:18:52 UTC
Well, NetBeans supports only the official Sass compiler, at least right now. But this should not be a big problem IMO. Simply:

- create a script which prints given parameters;
- select this script as Sass compiler in IDE Options;
- let NetBeans compile some Sass file.

-> Your script will print all parameters NetBeans uses for Sass compilation. First, NetBeans checks the version of Sass compiler whether source-maps can be used or not - for this call, simply return "Sass 3.4.0". Then your script will be called with parameters for compilation - simply ignore those ones your compiler does not support (like "--cache-location") and it should work I guess.
Comment 10 Tomas Mysik 2015-08-30 17:33:34 UTC
Guys, would it work for you if I add a system property for using libsass? It would mean that you would run NetBeans with this property and parameters like --cache-location would be omitted. Also, does libsass support source-maps? If yes, could anyone provide a sample command line call?

Thanks for your cooperation!
Comment 11 Tomas Mysik 2015-08-31 09:50:28 UTC
(In reply to Tomas Mysik from comment #10)
> Guys, would it work for you if I add a system property for using libsass? It
> would mean that you would run NetBeans with this property and parameters
> like --cache-location would be omitted. Also, does libsass support
> source-maps? If yes, could anyone provide a sample command line call?

One more question - is support sassc enough? Or are there any other popular clients/interfaces? Please, let me know so we can have this change in NB 8.1 final ;)

Thanks.
Comment 12 mbicknese 2015-08-31 13:11:55 UTC
Yes that should work!

For SassC the command would be:
> sassc --output-style compressed --sourcemap in.scss out.css

If output-style is omitted, the output style will be: nested


Personally I use node-sass. Sadly the command is just a tad different
> node-sass --output-style compressed --source-map in.scss out.css
Comment 13 Tomas Mysik 2015-09-01 07:59:06 UTC
(In reply to mbicknese from comment #12)
> For SassC the command would be:
> > sassc --output-style compressed --sourcemap in.scss out.css
> 
> If output-style is omitted, the output style will be: nested
> 
> Personally I use node-sass. Sadly the command is just a tad different
> > node-sass --output-style compressed --source-map in.scss out.css

Because the parameters are a bit different, it will be done this way:

- if property for libsass is used, no other parameters than "in.scss out.css" will be added by NetBeans (so, no source maps etc.). It means, that if you want to use source maps or compress style (or whatever other parameter), you need to provide them (either in Project Properties as compiler parameters or better directly as sass compiler parameters - it means that in IDE Options intead of "/bin/sassc" one will set "/bin/sassc --output-style compressed --sourcemap").

Please, let me know if this is not acceptable from any reason. Thanks.
Comment 14 mbicknese 2015-09-01 08:02:55 UTC
sounds perfect to me!
Comment 15 Tomas Mysik 2015-09-01 09:20:37 UTC
Should be done now, please verify. Ládo, please test that the official Sass support is not broken now :)

Instructions: if libsass should be used, start NetBeans with parameter [1]; this parameter can also be added to the <nbinstalldir>/etc/netbeans.conf (see netbeans_default_options variable). Then, the IDE will not add any command line parameter automatically - it means that it is up to user to specify proper CLI parameters (compress style, source maps etc.) for her CLI either in Tools > Options > HTML/JS > CSS Preprocessors or Project Properties dialog (CSS Preprocessors > Compiler Options field).

Thanks!
[1] -J-Dnb.sass.libsass=true

http://hg.netbeans.org/web-main/rev/33893ae1b219
Comment 16 Quality Engineering 2015-09-02 05:16:01 UTC
Integrated into 'main-silver', will be available in build *201509020320* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/33893ae1b219
User: Tomas Mysik <tmysik@netbeans.org>
Log: #247890 - SASS preprocessor does not support libsass/sassc

Unofficial support added only via a system property "nb.sass.libsass".
Comment 17 Vladimir Riha 2015-09-03 12:03:33 UTC
I checked basic Sass compilation in latest dev build and seems fine. I haven't touched the libsass though :)


Product Version: NetBeans IDE Dev (Build 201509030002)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14
System: Linux version 3.16.0-30-generic running on amd64; UTF-8; en_US (nb)
Comment 18 fehrlich 2015-09-14 15:03:18 UTC
how can i set system properties to test it ?
Comment 19 Tomas Mysik 2015-09-15 05:56:34 UTC
(In reply to fehrlich from comment #18)
> how can i set system properties to test it ?

See comment #15, detailed instructions can be found there.
Comment 20 fehrlich 2015-09-15 08:27:27 UTC
sry must have been blind. Thank you.

I just tested it, now i get the error "sassc.exe: unknown option -- trace". Is this another hard coded parameter ?
Comment 21 Tomas Mysik 2015-09-15 08:41:22 UTC
(In reply to fehrlich from comment #20)
> sry must have been blind. Thank you.

You are welcome.

> I just tested it, now i get the error "sassc.exe: unknown option -- trace".
> Is this another hard coded parameter ?

No. You had to specify it - either in IDE Options or Project Properties dialog. Again, see comment #15 for more information.

Thanks.
Comment 22 fehrlich 2015-09-15 08:48:28 UTC
sry didnt know you can set parameters in the project itself. There was still the "--trace" parameter. Now it works perfectly.

Thank you very much.
Comment 23 Tomas Mysik 2015-09-15 09:00:45 UTC
(In reply to fehrlich from comment #22)
> sry didnt know you can set parameters in the project itself. There was still
> the "--trace" parameter. Now it works perfectly.

Great to hear! Marking as VERIFIED then.

Thanks for reporting.
Comment 24 Tomas Mysik 2015-10-20 06:49:38 UTC
*** Bug 256020 has been marked as a duplicate of this bug. ***
Comment 25 Trzmiel 2017-07-18 11:05:21 UTC
The same bug still exists. Why did the bug reappear after being fixed?

Sass (compile):

"/usr/local/bin/sassc" "--cache-location" "/home/user/.cache/netbeans/8.2/sass-compiler" "--debug-info" "/home/user/www/project-01/scss/style.scss" "/home/user/www/project-01/css/style.css"
/usr/local/bin/sassc: unrecognized option '--cache-location'
See '/usr/local/bin/sassc -h'
Done.

---

Product Version: NetBeans IDE 8.2 (Build 201610071157)
System: Linux version 4.4.0-53 [Linux Mint]

$ sassc -h
Usage: sassc [options] [INPUT] [OUTPUT]

Options:
   -s, --stdin             Read input from standard input instead of an input file.
   -t, --style NAME        Output style. Can be: nested, expanded, compact, compressed.
   -l, --line-numbers      Emit comments showing original line numbers.
       --line-comments
   -I, --load-path PATH    Set Sass import path.
   -P, --plugin-path PATH  Set path to autoload plugins.
   -m, --sourcemap         Emit source map.
   -M, --omit-map-comment  Omits the source map url comment.
   -p, --precision         Set the precision for numbers.
   -a, --sass              Treat input as indented syntax.
   -v, --version           Display compiled versions.
   -h, --help              Display this help message.


$ sassc -v
sassc: 3.4.5
libsass: 3.5.0.beta.3-75-ga617
sass2scss: 1.1.0
sass: 3.5
Comment 26 Tomas Mysik 2017-07-19 09:04:40 UTC
Please, do not reopen verified issues. Simply create a new one, with exact steps to reproduce. Thank you.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo