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

Custom tasks while developing #490

Open
moklick opened this issue Aug 10, 2022 · 3 comments
Open

Custom tasks while developing #490

moklick opened this issue Aug 10, 2022 · 3 comments

Comments

@moklick
Copy link

moklick commented Aug 10, 2022

Hey!

We are building a library with the help of preconstruct. Everything is going great so far but we have one question:
How can we run custom tasks after preconstruct re-builds the project?

In our case we need to copy some css files to the dist folder. How can we do this while working on the library?
We are using preconstruct watch to auto-rebuild the project but we can't find a way to run our copy styles task.

dev: "precontruct watch && npm run styles" - doesn't work because the watch task is running indefinitely
dev: "npm run styles && precontruct watch" - doesn't work because watch clears the dist folder

Can anyone help us here?

@emmatown
Copy link
Member

I'd be happy to accept a PR that adds an experimental flag that skips deleting the dist directory when watching and then npm run styles && precontruct watch would work

@moklick
Copy link
Author

moklick commented Aug 11, 2022

Thanks! I will have a look. I am wondering how one could handle things like CSS or images with your library. I understand that you don't want to handle it within precontruct. But is there any way so that the files end up in the dist folder while developing?

@moklick
Copy link
Author

moklick commented Aug 18, 2022

I think a good solution for this would be to add something like an --onSuccess option, so that you could do:

preconstruct watch --onSuccess "npm run styles"

What do you think about that? If I find the time I can see if I can do a PR for this.

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

No branches or pull requests

2 participants