I think I see your problem now :) Within your /* */ comment block, you
have a #{} block. Dart Sass will still try and perform interpolation on a
#{} block within a /* */ comment block, but not on a line comment //
https://sass-lang.com/documentation/syntax/comments
You should only need to // comment any blocks that contain #{}. Your
solution of creating a custom macro in Netbeans to do // comments is
probably the best workaround :)
CC'ing to the NB mailing list so we have this for future reference if it
comes up again...
Have an awesome day!
P
On Tue, May 5, 2020 at 10:14 AM letrollpoilu <[email protected]>
wrote:
> Hi!
>
> Thanks a lot for your help, this really touches me :)
>
> The thing is that sometimes I got bugs in my sass code, so I want to
> comment parts/blocks to see where the issue is. Or simply comment old code
> and keep it there
> So I use Netbeans CTRL+SHFT+C to comment.
> But this is commenting with /**/ and this is still being compiled even
> though this is later stripped on a compressed mode (I always compile in
> compressed mode).
> So Dart Sass is giving me a compiling error because some buggy code
> commented with /**/ was compiled even in compressed mode...
>
> The best would be that CTRL+SHIT+C in .scss files would comment with //
> Just like for .sh files it comments with #
>
> So I would like to change the default way of commenting (actually the
> symbol) for .scss files.
> I figured out that this is not easy and I don't even know if I can look
> deeply into a config file and manually change a setting.
> I don't want to create a module and so on....
>
> For now I created custom macros that are adding // to a line so that I can
> quickly comment blocks of code with // instead of the default /**/
>
> For example you can in the following example test1 works but not test2.
>
> //.test1 {
> // width: (#{$undefinedvar1} + 3em);
> //}
>
> /*.test2 {
> width: (#{$undefinedvar2} + 3em);
> } */
>
>
> As it is sometimes quite annoying to manually comment with // and that
> CTRL+SHIT+C really did save me hours in my life, I wanted to know if there
> was anyway to configure it :)
>
> ------------------------------------------------------
> I don't have -J-Dnb.sass.libsass=true in my netbeans.conf file but I'm
> only compiling with an external script. This way I can compile and send the
> files via ssh directly. I'm using the module RunMyScript to start a .sh
> script compiling sass here is an extract:
>
> cd '[...]/sources/themes/[...]'
> echo "Compiling [...] scss..."
>
> [...]/dart-sass/sass scss/main_frontend.scss css/frontend.css
> --style=compressed
>
> echo ""
> echo "Sending to server..."
> scp css/* [...]@[...]:[...]/css
>
> -------------------------------------------------------
>
> I really thank you for your time, I really appreciate it, it's great to be
> able to talk to someone about those kind of issues :)
>
> Have a nice day !
>
>
>
>
>
>
>
> On 04/05/2020 22:08, Pete Whelpton wrote:
>
> Hi!
>
> Sorry to hear you are having problems. When you say you are having
> errors, do you mean a) Netbeans highlights errors in the compiled CSS file
> b) the Dart Sass compiler throws errors or c) the compiled CSS is invalid?
>
> Can you provide examples of the errors? If a), then it is most likely
> because the CSS grammar in Netbeans is not totally up-to-date. The grammar
> file also include Sass (scss) and Less grammar so is a total monster.
>
> if b) or c) then when Netbeans compiles a .scss file, all it does is pass
> the file to the Sass pre-compiler you specify in Netbeans options.
> According to Dart-Sass, " If a multi-line comment is written somewhere that
> a statement is allowed, it’s compiled to a CSS comment "
>
> If I create a file:
> @mixin test {
> /*color:red;
> font-size: #{var}*10;*/
> color:blue;
> }
>
> p {
> @include test;
> }
>
> This will compile to:
> p {
> /*color:red;
> font-size: var*10;*/
> color: blue;
> }
>
> As per Dart-Sass documentation, it compiles the comments to CSS comments
> (whether I compile via Netbeans or directly at the Command Line). If you
> want to surpress the comments totally, you can use Dart Sass' Compress
> Mode. This will compile to:
> p{color:blue}/*# sourceMappingURL=TestSass.css.map */
>
> Here's how to do it:
>
> 1) Make sure you have Netbeans configured to use a libsass
> implementation. Open /etc/netbeans.conf in a text editor and make sure
> -J-Dnb.sass.libsass=true
>
> is in your netbeans_default_options
>
> 2) Launch Netbeans. Open Menu->Tools->Options->HTML/JavaScript and make
> sure Sass path points to your dart-sass execuatble (e.g. sass.bat on
> Windows)
>
> 3) Tell your project to add the Compressed mode flag when calling
> dart-sass. Right click on your Project Node->Properties->CSS Preprocessors
> and in Compiler Options add:
> --style=compressed
>
> Next time your .scss compiles, in the Output window you should see the
> parameter pass to the Dart-Sass executable like this:
> "X:\Apps\dart-sass\sass.bat" "--style=compressed"
> "Y:\Projects\TestHTML\public_html\scss\TestSass.scss"
> "Y:\Projects\TestHTML\public_html\css\TestSass.css"
>
> And dart-sass should strip your comments during compile.
>
> Hope that helps,
>
>
>
> On Mon, May 4, 2020 at 3:01 PM letrollpoilu <[email protected]>
> wrote:
>
>> Hi all,
>>
>> This is the first time I'm using this mailing list because I'm a bit
>> desperate to find an answer to this question :)
>> I posted in on Stack here:
>> https://stackoverflow.com/questions/61527564/modify-comment-symbols-in-netbeans
>>
>> But you can still find below the question:
>>
>> I'm using Netbeans 11, and I have now switch from Ruby sass to Dart sass.
>> The thing is that when I comment a block of code on my .scss files, they
>> are commented like that:
>>
>> @mixin test($var){
>> /*color:red;
>> font-size: #{var}*10;*/
>> color:blue;}
>>
>> The thing is that now in Dart sass, what's in between the /**/ is
>> compiled and raises sometimes errors. Though I just want to comment it. So
>> I would need to comment this way:
>>
>> @mixin test($var){
>> //color:red;
>> //font-size: #{var}*10;
>> color:blue;}
>>
>> This is fine for 2 lines, but sometimes I need to comment big blocks, and
>> Netbeans is not using the // but /**/. So is there a way to change the
>> default commenting of Netbeans for .scss files? I mean this has to be
>> somewhere since you can sometimes comment in blocks with #.
>>
>> Any help would be greatly appreciated. Thanks a lot in advance!
>>
>
>