PhpStorm SCSS fails to build with file watcher - css

I have been using the same settings for few years now and today after trying to change some SCSS code I got this ERROR:
/usr/local/lib/node_modules/sass/sass.js --no-cache --update main.scss:../../public/assets/css/main.css --style compressedcss
Could not find an option named "no-cache".
Usage: sass <input.scss> [output.css]
sass <input.scss>:<output.css> <input/>:<output/> <dir/>
━━━ Input and Output ━━━━━━━━━━━━━━━━━━━
--[no-]stdin Read the stylesheet from stdin.
--[no-]indented Use the indented syntax for input from stdin.
-I, --load-path=<PATH> A path to use when resolving imports.
May be passed multiple times.
-s, --style=<NAME> Output style.
[expanded (default), compressed]
--[no-]charset Emit a #charset or BOM for CSS with non-ASCII characters.
(defaults to on)
--[no-]error-css When an error occurs, emit a stylesheet describing it.
Defaults to true when compiling to a file.
--update Only compile out-of-date stylesheets.
━━━ Source Maps ━━━━━━━━━━━━━━━━━━━━━━━━
--[no-]source-map Whether to generate source maps.
(defaults to on)
--source-map-urls How to link from source maps to source files.
[relative (default), absolute]
--[no-]embed-sources Embed source file contents in source maps.
--[no-]embed-source-map Embed source map contents in CSS.
━━━ Other ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-w, --watch Watch stylesheets and recompile when they change.
--[no-]poll Manually check for changes rather than using a native watcher.
Only valid with --watch.
--[no-]stop-on-error Don't compile more files once an error is encountered.
-i, --interactive Run an interactive SassScript shell.
-c, --[no-]color Whether to use terminal colors for messages.
--[no-]unicode Whether to use Unicode characters for messages.
-q, --[no-]quiet Don't print warnings.
--[no-]quiet-deps Don't print compiler warnings from dependencies.
Stylesheets imported through load paths count as dependencies.
--[no-]verbose Print all deprecation warnings even when they're repetitive.
--[no-]trace Print full Dart stack traces for exceptions.
-h, --help Print this usage information.
--version Print the version of Dart Sass.
Process finished with exit code 64
I gave tried reinstalling the Ruby Sass but nothing works... Any idea how to fix this?

Related

How to specify indent in jq config file?

Instead of always giving the --indent n flag on the command line, I would like to specify this in a config file (or library or module file – I'm not sure what the correct terminology is).
I tried putting various things in ~/.jq, such as indent: 4 or --indent 4, but they always gave me a compile error when I invoked jq. I looked at the manual but couldn't see any information on how to do this, nor find anything in the issues on GitHub.
Is it possible?
The ~/.jq file contains jq code such as function definitions. It's not a config file in the classical sense.
Most shells support aliases and you could set one yourself, e.g. in ~/.profile or ~/.bashrc/~/.bash_aliases with:
alias jq='jq --indent 4'
When invoked in an interactive shell, the alias will be resolved to the command including the option. Note however that aliases are ignored in shell scripts (i.e. non-interactive mode) by default.

Correct PhpStorm node-sass syntax in "File Watchers" "Arguments" field

node-sass syntax described at https://www.npmjs.com/package/node-sass and https://www.npmjs.com/package/node-sass#command-line-interface does not work for PhpStorm File Watchers.
Following the instructions in those links, I have tried different combinations and positions in the "Arguments" field with no success. I also checked all similar questions on this subject but none answers my question:
Can anybody help me with the correct syntax to compile a minified file with a filename ending with .min.css, in a directory different from the source directory?
node-sass cli syntax does definitely work in file watchers, just in the same way as in command line. Suggested syntax to save the compressed .css file in <project root dir>/css folder is
$FileName$ --output-style=compressed --source-map=true -o $ProjectFileDir$/css
there doesn't seem to be a way to pass the target file name when using -o option. If you are aware of any, modify the arguments accordingly

Compile With Static Library Using GNAT

To learn the processes behind compilation of Ada programs (without resorting to using gpr), I've decided to compile one of my projects manually. To compile a program, I run the following command on each .adb file therein (not manually, however):
$ gcc -c src/<file>.adb -o obj/<file>.o
That compiles all the files and puts them in the obj directory.
Or rather, it would. There is a slight problem with this. I have an archive (static library) that I've generated from another project, called libapples.a, containing package Apples. The Apples package is used by the files you see me compiling above.
Since libapples.a doesn't have source files anymore (given its archive format), it's not viable (not even possible) to provide the sources of that library to the command above using -I switches; on the other hand, if I don't have the sources included, the command above comes back to me saying:
<file>.adb:<y>:<x>: file "apples.ads" not found
gnatmake: "src/<file>.adb" compilation error
I've attempted to include the library in the compilation process by using flags -L and l (which I believe is how you'd do it in C; feel free to correct me if I'm wrong). In another attempt I placed the archive right in the source directory.
How does one go about including a library in the compilation process?
apples.ads is somewhat like a header in C and you definitely need it for your file to compile. You should use -I to point gcc to the directory where apples.ads is located in.
Be aware that compiling an Ada source not only yields an object file, but also an Ada Library Information (.ali) file. You'll need that for the next step. You should not use the -o flag because it may lead to your .o and .ali files having different names.
On the other hand, since you only want to produce an object file, you should use -c to tell gcc to only compile. In other languages like C, gcc compiles and links by default; in Ada, the process is more complex.
After compilation, you need to call gnatbind on the .ali file of your main program. This generates a package that will take care of proper initialization of everything. To do that, gnatbind needs the .ali file of the Apples package! You can specify the .ali search directory with -aO.
Finally, gnatlink called on the main .ali file will link everything together. It figures out itself which object files and libraries it needs. It will append the necessary options to the linker, including the reference to libapples.a. It also compiles the package generated by gnatlink.
I don't know exactly what gnatlink will do under the hood; you could probably compile the package generated by gnatbind manually and then call the linker if you can figure out the proper arguments.

How do you get cmake to add compiler definitions only for automoc files

Our project is using very strict set of warnings, but Qt5 generated moc files produce code that violates these warnings. We could obviously turn off the warnings globally, but I'd like to just suppress the warnings for the automoc files.
For example:
In file included from /Users/stebro/client/build/NotificationServer/Notification_automoc.cpp:2:
/Users/stebro/client/build/NotificationServer/moc_NotificationServer.cpp:100:18: error: dereference of type '_t *' (aka 'void (carbonite::NotificationServer::**)(const QByteArray &, const QString, const QVariant)') that was reinterpret_cast from type 'void **' has undefined behavior [-Werror,-Wundefined-reinterpret-cast]
if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&NotificationServer::notificationQueued)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following doesn't work:
set_property(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
PROPERTY COMPILE_DEFINITIONS -Wundefined-reinterpret-cast
)
cmake complains:
set_property DIRECTORY scope provided but requested directory was not
found. This could be because the directory argument was invalid or, it is
valid but has not been processed yet.
I can't use set_property(FILE ...) because I don't have a comprehensive list of files that are automoc'd at the time the makefile is build (so presumably GLOBing won't work either). I don't want to hand-maintain a list of all moc files that will get generated by the build.
A bit late but I found a solution that works (CMake 3.16).
First off, Automoc cannot generate warnings. It is a preprocessor that takes a cpp file and generate a moc file. This operation will not generate compilation warnings.
In CMake, when you set the AUTOMOC property to true, CMake does (at least) two things:
It gives all your sources to MOC to generate the moc files (these MOC files are not added to your target and we do not care about them)
It creates a mocs_compilation.cpp file that includes all the necessary moc files, adds this file to your target then compile it.
Only this second operation can generate warnings. It's that compilation step that you want to silence.
In my case (CMake 3.16), the mocs_compilation file is generated in the following path:
${<target_name>_BINARY_DIR}/<target_name>_autogen/mocs_compilation.cpp
And once you know that path, you can silence some warnings by passing compilation flags only to this file in particular:
set_source_files_properties("<target_name>_autogen/mocs_compilation.cpp" PROPERTIES COMPILE_FLAGS "-Wno-undefined-reinterpret-cast")
Even if paths change in the future, CMake always had a "general" cpp file that includes all the other MOC files. If you can find the path to this file, this solution will work.
In your case (older CMake version), this file is Notification_automoc.cpp, so the following line should work:
set_source_files_properties("Notification_automoc.cpp" PROPERTIES COMPILE_FLAGS "-Wno-undefined-reinterpret-cast")
You can disable all AUTOMOC warnings by passing the 'no warning' option on the moc command line. CMAKE_AUTOMOC_MOC_OPTIONS initializes the AUTOMOC_MOC_OPTIONS whose documentation is linked below.
SET(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTOMOC_MOC_OPTIONS "-nw")
AUTOMOC_MOC_OPTIONS reference
moc command line arguments reference

scss builder for cloud9 web editor

Hey there :) I'm trying to figure out how I can make a scss builder for cloud9. I could only find something for less here on stackoverflow.
I'm trying to get main.scss in my scss folder to be compiled into main.css in a css folder at the same level.
The builder:
{
"caption" : "SCSS",
"cmd": ["scss", "$file", "-x", "${file/\\.scss/\\.css/}"],
"selector": "source.scss"
}
Error:
OptionParser::InvalidOption: invalid option: -x
Use --trace for backtrace.
I think the way you're using the Cloud9 builder is correct, however, I couldn't find the -x option within scss. Here's what scss -h gives me:
Usage: scss [options] [INPUT] [OUTPUT]
Description:
Converts SCSS or Sass files to CSS.
Common Options:
-I, --load-path PATH Specify a Sass import path.
-r, --require LIB Require a Ruby library before running Sass.
--compass Make Compass imports available and load project configuration.
-t, --style NAME Output style. Can be nested (default), compact, compressed, or expanded.
-?, -h, --help Show this help message.
-v, --version Print the Sass version.
Watching and Updating:
--watch Watch files or directories for changes.
The location of the generated CSS can be set using a colon:
scss --watch input.scss:output.css
scss --watch input-dir:output-dir
--poll Check for file changes manually, rather than relying on the OS.
Only meaningful for --watch.
--update Compile files or directories to CSS.
Locations are set like --watch.
-f, --force Recompile every Sass file, even if the CSS file is newer.
Only meaningful for --update.
--stop-on-error If a file fails to compile, exit immediately.
Only meaningful for --watch and --update.
Input and Output:
--sass Use the indented Sass syntax.
--sourcemap=TYPE How to link generated output to the source files.
auto (default): relative paths where possible, file URIs elsewhere
file: always absolute file URIs
inline: include the source text in the sourcemap
none: no sourcemaps
-s, --stdin Read input from standard input instead of an input file.
This is the default if no input file is specified.
-E, --default-encoding ENCODING Specify the default encoding for input files.
--unix-newlines Use Unix-style newlines in written files.
Always true on Unix.
-g, --debug-info Emit output that can be used by the FireSass Firebug plugin.
-l, --line-numbers Emit comments in the generated CSS indicating the corresponding source line.
--line-comments
Miscellaneous:
-i, --interactive Run an interactive SassScript shell.
-c, --check Just check syntax, don't evaluate.
--precision NUMBER_OF_DIGITS How many digits of precision to use when outputting decimal numbers.
Defaults to 5.
--cache-location PATH The path to save parsed Sass files. Defaults to .sass-cache.
-C, --no-cache Don't cache parsed Sass files.
--trace Show a full Ruby stack trace on error.
-q, --quiet Silence warnings and status messages during compilation.
Here's something that should work for you:
{
"cmd" : ["scss", "$file", "$file_path/../css/$file_base_name.css"],
"info" : "Building $file_path/$file_name",
"selector": "source.scss"
}
Where $file is the full path, $file_path is the directory path, and $file_base_name is the name of your file without the extension. You can take a look at the other variables available to you here.

Resources