Skip to content
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

(1) cmd tool (watch) does NOT work for template (2) does NOT work for all formats when using vscode editor #372

Closed
sgon00 opened this issue Feb 5, 2021 · 2 comments

Comments

@sgon00
Copy link

sgon00 commented Feb 5, 2021

Some backgrounds

  • Sorry that I did a lot of editing after opening this issue. Now, after I understand the problem even more clear, I will try to reformat the question again. I hope my words make sense. Thank you very much for your project and help.

  • There are actually 4 problems. I am not sure if I should open 4 issues or just single one. I will try to describe 4 problems here for now.

  • I am running Linux OS (MX Linux based on debian 10).

  • I installed the latest minify cmd tool from the git clone source at the time I am posting this issue.

  • Values of my variables:
    $CSS_SRC_PATH is web/src/css/
    $CSS_DST_PATH is web/dist/css/
    $TMPL_SRC_PATH is web/src/template/
    $TMPL_DST_PATH is web/dist/template/

(1) cmd tool watch feature does NOT work for template

minify -w -r --type=html -o $TMPL_DST_PATH $TMPL_SRC_PATH

The above command does NOT work at all. There is no minifying happened.

Then I tried the following cml:

minify -w --type=html -o $TMPL_DST_PATH $TMPL_SRC_PATH/*.tmpl

The above command only minifies files once. The -w watching does NOT work at all. After I change something in the src tempate, there is no further minifying update.

(2) cmd tool watch does NOT work for all formats when the src is not a directory

From the README.md, it should work when src is not a directory, but it doesn't work.

minify -w -o $CSS_DST_PATH $CSS_SRC_PATH/*.css

The above -w watch command does NOT work. No watch update at all.

minify -w -o $CSS_DST_PATH $CSS_SRC_PATH/test.css

The above -w watch command does NOT work. No watch update at all.

(3) cmd tool watch does NOT work when target/destination is not a directory

From README.md, the example shows I can use non directory destination with watch.

minify -w -o $CSS_DST_PATH/test.css $CSS_SRC_PATH/test.css

The above command does NOT work at all. Error msg: ERROR: --watch requires destination to be a directory.
If destination can not be a non-directory, I can not give a different destination filename when using minify+watch.

(4) cmd tool watch does NOT work for all formats when using vscode editor

minify -w -r -o $CSS_DST_PATH $CSS_SRC_PATH

When I use vscode editor and opened both src and dst files. After I update src css file, the target file becomes an empty file most of times.

When I use some simple editor such as vim or kwrite, the watch update works as expected.

I have no ideas what's going on with rich editors (or IDEs). I don't have auto-save turned on in vscode editor.
I did save only once after the modification update. But magically, the target file will become empty.
I never meet such problem with other watching update tools such as gulp watch tools etc...

Thank you very much for your time.

@sgon00 sgon00 changed the title cmd tool does NOT work properly when minifying html template files cmd tool (watch) does NOT work when minifying html (template) file Feb 5, 2021
@sgon00 sgon00 changed the title cmd tool (watch) does NOT work when minifying html (template) file cmd tool (watch) does NOT work when minifying Feb 5, 2021
@sgon00 sgon00 changed the title cmd tool (watch) does NOT work when minifying cmd tool (watch) does NOT work Feb 5, 2021
@sgon00 sgon00 changed the title cmd tool (watch) does NOT work cmd tool (watch) does NOT work on template (non .html ext) AND does NOT work when using vscode editor for all formats Feb 5, 2021
@sgon00 sgon00 changed the title cmd tool (watch) does NOT work on template (non .html ext) AND does NOT work when using vscode editor for all formats (1) cmd tool (watch) does NOT work for template (2) does NOT work for all formats when using vscode editor Feb 5, 2021
@tdewolff
Copy link
Owner

tdewolff commented Feb 5, 2021

Thanks for the elaborate bug report. Looks like the watch functionality needs some work. However, to address two concerns: 1) minifying templates is not really supported, though even so the watch functionality should work. I will look into this. 4) some IDEs work differently with saving files which may affect the watch function. I should install vscode and see how it saves files.

This will take some time to fix, thanks again for the report!

tdewolff added a commit that referenced this issue Mar 9, 2021
@tdewolff
Copy link
Owner

tdewolff commented Mar 9, 2021

Fixed a bunch of bugs in the watch functionality, please check if it's working well for you (the points you addressed should all be fixed now). Feedback appreciated ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment