Skip to content

Custom tasks while developing #490

Open

Description

@moklick

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?

Activity

  1. emmatown commented on Aug 10, 2022

    @emmatown
    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

  2. moklick commented on Aug 11, 2022

    @moklick
    Author

    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?

  3. moklick commented on Aug 18, 2022

    @moklick
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions