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

Bug: npx tailwindcss with args --watch #267

Open
ArcSoul opened this issue Mar 30, 2023 · 2 comments
Open

Bug: npx tailwindcss with args --watch #267

ArcSoul opened this issue Mar 30, 2023 · 2 comments
Labels
question Further information is requested

Comments

@ArcSoul
Copy link

ArcSoul commented Mar 30, 2023

Description

Hi, I tried to execute the following task (go to reproduce the error for more details) and the problem is when I added --watch in args, when I add this command, it did not work, I don´t know why does this happens, Is there a bug when I execute some command with --watch like ng server --watch or similar? I tried to, execute Spring boot application and execute tailwind in parallel because I used thymeleaf.

Note: I clarify that the command does work if I remove the --watch, but I want the file to be pending changes

Reproduce error

     1 -- I made a task in build.gradle

tasks.register('frontend', NpxTask) {
    command = 'tailwindcss'
    ignoreExitValue = true

    inputs.files('package.json', 'package-lock.json', 'tailwind.config.js', 'postcss.config.js')
    inputs.files(fileTree('./src/main/resources/static'))
    inputs.files(fileTree('./src/main/resources/templates'))

    outputs.dir('./build/resources')

    dependsOn('npmInstall')
    args =  ['-i', './src/main/resources/static/css/tailwind.css', '-o', './src/main/resources/static/css/tailwind.min.css', '--watch']
}

     2 -- I run gradle frontend

     3 -- I saw to next response

22:02:28: Executing 'clean frontend'...

> Task :clean
> Task :nodeSetup UP-TO-DATE
> Task :npmSetup SKIPPED
> Task :npmInstall UP-TO-DATE
> Task :frontend

BUILD SUCCESSFUL in 1s
4 actionable tasks: 2 executed, 2 up-to-date
22:02:30: Execution finished 'clean frontend'.

Expected behavior

I expected to generate the file tailwind.min.js in /src/main/resources/static/css/tailwind.min.css.

@ArcSoul ArcSoul changed the title Bug: npx tailwindcss Bug: npx tailwindcss with --watch Mar 30, 2023
@ArcSoul ArcSoul changed the title Bug: npx tailwindcss with --watch Bug: npx tailwindcss with args --watch Mar 30, 2023
@deepy
Copy link
Member

deepy commented Apr 2, 2023

Unfortunately I'm suffering through some dental issues so I might be a bit brief here, but just to make certain I'm not missing something:
Are you trying to run Gradle with --watch or having a long-running Gradle process for bootRun while running another Gradle with the frontend task at the same time?
(or a long-running Gradle process with both tasks, i.e. ./gradlew bootRun frontend and want it to continously run and re-deploy your frontend upon changes?)

It's kinda strange that it works without --watch but not with it. I'd expect it to work as you expect, or to run once ignoring the --watch, or to error out and give an error message

But personally when I've worked on frontends and backends separately I've always had a node start a dev server that watches for changes and redeploys the entire frontend while proxying all requests to the backend
And then at the same time had JRebel or something else do hot reloads on the JVM-side. In fact, the Spring documentation has some mentions of hot-swapping and now I kinda wanna add another example build using that

@deepy deepy added the question Further information is requested label Apr 16, 2023
@sanderhoksbergen
Copy link

Just an FYI since I ran into this but without a workaround yet: the same thing happens in Docker, requiring a tty: true flag, so I suspect it terminates if stdin is an empty stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants