New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: SASS integration is broken - removed old parameter "--cache-location" #1234
Conversation
I did some quick testing today. Using the latest version of dart-sass, if "Generate sourcemaps" option is selected in the NB CSS Preprocessor options, an error still occurs because --debug-info is appended to the executable. I suspect that this is because the version check method isn't working correctly either - because this class was designed for Ruby SASS, not libsass implementations. I did some digging in the source - this SassExecutable.java class was for the original Ruby implementation of SASS. All modern implementations of SASS appear based on libsass. There is already a class for consuming libsass based implementations in Netbeans. LibSassExecutable.java As an alternative, I would propose:
Hope that helps! |
As far as I know remove those paramters won't hurt new Ruby SASS implementation. PS: I see that you right, we should also remove |
@peedeeboy does the updated changeset make sense to you? If it improves the situation and does not introduce regressions, we should IMHO merge it. |
@maxcuttins Thank you so much for working on this, I've seen this brought up a couple of times so I'm sure quite a few people will be happy to see SASS support working again :) Apologies I haven't got around to testing until now! I've tested on Windows with the dart-sass batch file, and with the .js implementation running through node. Both worked ok including adding additional parameters via the Project properties. @matthiasblaesing Yes - this definitely makes things better and I think you are right to merge. I was a bit apprehensive as I saw in the old bugzilla that these parameters had already been removed in the past, then re-added later (probably for the reasons I mention - there is an incomplete class specifically for libsass implementations). See here: https://netbeans.org/bugzilla/show_bug.cgi?id=271126 There is still a bit of work to do in the long run, as the SassExecutable class was designed for Ruby SASS, some of the other methods such as checking version won't get the results they expect. The only downside to this that I found in testing is that the Generate Sourcemaps flag in NB Options won't have any effect (due to the logic in the version check above not working with as expected with libsass implementations). However, this can be worked around by adding the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to merge, but while testing I observed two things:
- @maxcuttins please ensure that your author information in git is valid. Your author email ends with "@users.noreply.github.com"
- This changeset introduces a regression for ruby sass users. Without the "--cache-location" parameter, the cache is placed into the
public_html
directory. That way it pollutes the work space of the user.
What do you think about this idea: use the "--help" call to see which options are supported. If an option is listed, it can be used (this assumes, that they are compatible).
Hi @maxcuttins ! Have you had chance to look at Matthias' feedback? Would you like any help? And if you are too busy to look at this further, would you mind if I did? Cheers! |
I guess it's overwritten by GitHub.
This is right but should be left as it is. 1) the Ruby version is supported but deprecated and should not be used anymore. 2) if you still want to use the Ruby version, you can always add all the arguments that you need on the command line in the Project Properties in order to get the behaviour you want. Everybody use the command line option to add I think we should avoid to hard-code old/deprecated/distribution-specific arguments that will break any other version of SASS.
Are you talking about cast everytime |
Technical issueI had another look in the code and @peedeeboy already gave the right hint. NetBeans allows switching from the original sass implementation to libsass based implementations via a system property Testing can be done:
Or with any recent netbeans installation:
With that, Having said this, why not just follow @peedeeboy suggestion (third bullet point): private static final boolean USE_LIBSASS = Boolean.parseBoolean(System.getProperty("nb.sass.libsass", "true")); // NOI18N The above code updated in Username issue
For your concrete problem: You most probably set the option "Keep my email addresses private` in you Settings (Personal settings -> Emails). IMHO this is not a valid way to contribute. It can be argued, that the change is small enough to be doable from a WebGUI, you obvisously did not run UnitTests for the changeset. |
Maybei'm in wrong (probably) but I don't think that this is can be set by GUI interface.
I didn't know that there was already a property available in order to switch the type of SASS.
By having already a property, this is defintly the best way to go.
Thanks! Checked just yesterday after my post.
I know and I agree with you, exactly as you wrote the argued is this fix was just about remove an argument |
Hi @maxcuttins :)
If I understand @matthiasblaesing correctly, he is suggesting that as a quick fix, we flip the default value so that libsass becomes the default implementation instead of RubySASS (as 99% of people will be using libsass based implementations of sass nowadays). Any legacy RubySASS users can add a parameter to their netbeans.conf file, until an option is added to the Netbeans GUI CSS Preprocessor options. To implement that, you will need to: 1. ide/css.prep/src/org/netbeans/modules/css/prep/sass/SassExecutable.java 2. ide/css.prep/src/org/netbeans/modules/css/prep/sass/SassCli.java private static final boolean USE_LIBSASS Boolean.getBoolean("nb.sass.libsass", ); // NOI18N` to: private static final boolean USE_LIBSASS = Boolean.parseBoolean(System.getProperty("nb.sass.libsass", "true")); // NOI18N This will make libsass flag default to true unless Netbeans is started with the 3. ide/css.prep/src/org/netbeans/modules/css/prep/sass/LibSassExecutable.java private static final String SOURCEMAP_PARAM = "--source-map"; // NOI18N
private static final String NO_SOURCEMAP_PARAM = "--no-source-map"; // NOI18N Add the following lines into the // sourcemaps
boolean debug = CssPrepOptions.getInstance().getSassDebug();
if(debug) {
params.add(SOURCEMAP_PARAM);
}
else {
params.add(NO_SOURCEMAP_PARAM);
} Those lines should come after: List<String> params = new ArrayList<>(); and before: // compiler options
params.addAll(compilerOptions); Shout if you get stuck! 👍 |
The situation is a bit more complex as each tool should have its own options (insert sarcastic comment here), sassc and node-sass do not share the same CLI options.
So while both are based on |
Thanks @matthiasblaesing Perhaps the best thing to do for libsass implementations is rely on the command line options being set in the project properties. Regarding the Netbeans CSS PreProcessor options, either: The |
…can be used by default. apache#1234
…can be used by default. apache#1234
fix the bug https://netbeans.org/bugzilla/show_bug.cgi?id=271126