PhpStorm file watcher does not watch for MJML files

I have installed the MJML from node package manager globally and then created a mjml filetype in PhpStorm and added a new File Watcher for MJML files with the following settings.

Name: MJML
Type: MJML from the dropdown
Program: /usr/bin/mjml
Argument: --watch $FileName$ -o $FileNameWithoutExtension$.html
Working Directory: $FileDir$

PhpStorm Version

PhpStorm 2016.3.2
Build #PS-163.10504.2, built on December 20, 2016
Licensed to PhpStorm Evaluator
Expiration date: April 3, 2017
JRE: 1.8.0_112-release-408-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

For some reasons it does not watch and generate the output file.

7 comments

If you try ctrl+shift+A (find action) and search for "run file watcher" - would it work?

Would it work if you start it manually (in cmd)?

0

It works if I run the command manually in terminal mjml --watch index.mjml -o index.html but the PhpStorm does not watch the file. 

Extra info: File watchers run in Mac but does not generate output file. 1 process running is the output i am seeing the status bar. 

0

Just checked - the watcher

does generate the output file. But you need to refresh the project manually using File | Synchronize to see the generated file, and watcher never completes.

This is the expected behavior: PhpStorm waits for exit code from a tool run as file watcher in order to refresh virtual file system. As MJML run with `--watch` option is kept running until you kill it, and thus doesn't return exit code when file generation completes,  VFS is not auto-synchronized, and the watcher is kept running. So, the solution is to use `-r` instead of `--watch`:

-r $FileName$ -o $FileNameWithoutExtension$.html

 

You have already registered mjml as a watcher in PHPStorm, no need to pass `--watch` to it

0

The above solution works in Mac but in Lubuntu, it does not. The problem is if I set the Mjml filetype in the File Watcher the file watcher is not starting. If I set filetype as Any it starts and generates the HTML file.

0

most probably something is wrong with scope/type definition. Doesn't look like OS-specific issue

0

So Can I know what are you suggesting? I have created the filetypes and set the patterns the same way like MacOS? There is a warning displayig "No such file in scope.".  

0

I can only suggest to check your watcher scope/file type definition. Warning is clear enough: there are no files that match your file type definition in your file watcher scope

0

Please sign in to leave a comment.