S
S
Sergey delphinpro2018-06-28 13:35:37
phpstorm
Sergey delphinpro, 2018-06-28 13:35:37

How to make phpStorm understand custom function in scss?

Now I'll ask another question, which will not be answered =))
A custom function was written for the gulp-sass plugin b64(), which encodes the given image in base64 and inserts it into the resulting css.
Using the function looks like this:

background-image: b64("source/images/menu-dropdown-hover.png");

5b34b8677259c768672387.png
And here two problems arise:
1. The IDE does not know that such a function exists in sass.
2. And as a result, it cannot resolve the path in its parameter.
Actually, the question is, is it possible to somehow tell the environment that the function exists, and that its parameter is the path to the file that needs to be resolved?
PS I'm aware of existing gallp plugins for base64, but they work in auto-mode, mostly by file size threshold. This is not suitable, manual control of injected css files is required.
PPS Writing a plugin for an IDE is not worth suggesting =)) There is neither time nor skills for this. Interested in the availability of standard features, or features provided by already written plugins.
UPD Sample Code
function b64(file, done) { … }

let sassOpts = { ... }
sassOpts.functions = {}
sassOpts.functions['b64($file)'] = b64;

...

.pipe(sass(sassOpts))

UPD2
Declared a function in sass itself
@function b64($file) {
  // а эта объявлена в js и делает всю обработку.
  // Здесь она также не резолвится, ну да ладно.
  @return _b64($file);
}

The second problem remains - the IDE path does not resolve.
Are there phpdoc analogues for sass with support in the specified IDE?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question