Git Product home page Git Product logo

Comments (4)

ianstormtaylor avatar ianstormtaylor commented on May 17, 2024

Sorry, but I don't think this is a good idea.

The metalsmith-watch plugin makes assumptions about the builds that shouldn't be made, so it is broken itself, and doesn't mean that other plugins should be edited or core edited because it makes those assumptions. Since Metalsmith is all about transforms, you can't assume that passing different combinations of files through the build process (depending on which ones changed in this case) will result in the full build being correct. That's a core truth to using Metalsmith as far as I can tell, and one which makes it powerful.

You'd have the same problem not only with middleware that should act once, but with any middleware that uses context from other files to produce it's output.

from metalsmith.

aymericbeaumet avatar aymericbeaumet commented on May 17, 2024

That's a good abstraction of the problem. But I wonder: if this plugin is broken, why is it present on the official website? It encourages bad practices on Metalsmith development.

Considering your answer, the only feasible solution would be to trigger the whole build again each time a file changes, there is three opinions on this:

  • this is not the Metalsmith job to watch for file changes. It should be handled by an external tool.
  • this can be natively handled by Metalsmith.
  • this can be handled by a Metalsmith plugin.

For the last 2 suggestions, a cache system could be implemented in order to avoid excessive read-access, and only refresh the cache entries concerned by the modifications.

I would really appreciate a functionality like this to faster my development with Metalsmith. I'm ok to do some development but I would like your way of thinking to work in the good direction.

from metalsmith.

FWeinb avatar FWeinb commented on May 17, 2024

Author of metalsmith-watch here. I remember that we had this discussion before (about including a watcher in core) but that was out of scope that time.

It is true that metalsmith-watch makes assumptions that will break with certain plugins but this is due to the fact that it is not feasible to rebuild the whole project for every file change.

Furthermore metalsmith is not exposing a method to re trigger the build, so I had to hack around this to make metalsmith-watch work in the first place.

I would be really glad if we could find a way to make this work.

from metalsmith.

aymericbeaumet avatar aymericbeaumet commented on May 17, 2024

Which constraints restrain you from rebuilding the whole project on each modification? Is it for performance reasons?

Doing so would ensure the build integrity.

from metalsmith.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.