11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.09k stars 494 forks source link

🛑 AutoWatch `{% included "file" %}` 👍👎 #2342

Open nitin2953 opened 2 years ago

nitin2953 commented 2 years ago

Is your feature request related to a problem? Please describe. I have index.njk in which I have included a css & js file, when I save changes to those file they not get compiled in index.njk. I have to save the index.njk file in order to recompile it with included files

Describe the solution you'd like Automatically add/remove included files into watch list on save.

Describe alternatives you've considered

eleventyConfig.addWatchTarget("src");

But I have to save the included file TWICE, I think this will cause performance issue.

Additional context

--- DIR STRUCTURE ---
•
├── dist/
│   └── index.html
├── src/
│   ├── index.njk
│   ├── script.js
│   └── styles.scss
└── .eleventy.js
zachleat commented 2 years ago

I made a test case for this issue using the description provided and was not able to reproduce. Can you share a test case that shows the issue?

nitin2953 commented 2 years ago

⚠ Looks like video is not playing in *browser*, please download it

https://user-images.githubusercontent.com/34852979/168261446-7d71c01e-4c9a-46f3-a880-58c1ee0389f9.mp4

Repo: https://github.com/nitin2953/date-diff-test/tree/11ty-test


index.njk <-{% include "FILE" %}

zachleat commented 1 year ago

This seems to be working fine with eleventyConfig.addWatchTarget("scss"); or eleventyConfig.addWatchTarget("."); (as is default in your repo)

Can you attach a DEBUG output? Specifically I’m looking for these entries:

Eleventy Watching for changes to: [ './scss/**',          './**/*.liquid', './**/*.ejs',         './**/*.md', './**/*.hbs',         './**/*.mustache', './**/*.haml',        './**/*.pug', './**/*.njk',         './**/*.html', './**/*.11ty.js',     './**/*.11ty.cjs', './js/lib/**',        './_includes/**', './_data/**',         './.eleventy.js', './**/*.json',        './**/*.11tydata.cjs', './**/*.11tydata.js' ] +2ms
  Eleventy Ignoring watcher changes to: [ 'node_modules/**', 'node_modules/**', 'dist', 'tmp', 'zen', 'dist/**' ] +1ms
zachleat commented 1 year ago

(Also it wouldn’t hurt to upgrade to the latest canary)