Comments (4)
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.
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.
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.
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)
- drag and drop theme builder HOT 4
- Add Metalsmith.watch method?
- CLI - init command HOT 1
- MS files should not depend on Object prototype
- Debug not working as expected? HOT 2
- Don't crash on broken symlinks that are ignored HOT 4
- Proposal for metalsmith.get/set() helpers HOT 1
- Metalsmith 2.6 Roadmap HOT 3
- Ordinary html file not recognized as utf-8 encoded, stopping gray-matter to parse YAML HOT 3
- Launch procedure to deprecate @types/metalsmith HOT 2
- Build callback not fired with `watch()` + async plugins HOT 13
- Feature: add encoding: utf-8 property to `File` HOT 1
- Feature: provide metalsmith.on('built')
- Unhandled rejection when using callbacks (i.e. with `.watch(spec)`) HOT 2
- CLI: parse metalsmith.json as front-matter
- UnhandledPromiseRejection when plugins callback with failure HOT 8
- Remove metalsmith.concurrency?
- Feature: metalsmith.run() getter HOT 1
- Reduce ambiguity in config options
- Add Metalsmith.imports method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metalsmith.