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

Adding custom watch target doesn't inject CSS on initial file change (save) event #847

Closed
ryanscherler opened this issue Jan 9, 2020 · 6 comments
Labels
bug duplicate feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc

Comments

@ryanscherler
Copy link

ryanscherler commented Jan 9, 2020

Describe the bug
It seems that when adding a custom watch target such as src/assets/, BrowserSync is not live updating the CSS after the initial save to that directory (e.g. src/assets/css/app.css), but when saved again, it is injected.

To Reproduce
Clone this repo: https://github.com/eastslopestudio/eleventy-starter

  1. Follow setup setup instructions [npm install etc...]
  2. Run npm run start to fire things up
  3. Go to an arbitrary source CSS file such as src/assets/css/app.css and then add something high level such as body { background: red } and watch for live changes to the site. It likely won't work, BUT, save it again (no changes, just save), and bam, it updates the BrowserSync timestamp (and thus injects the new changes).

Expected behavior
The file change to one of the CSS files in the src/assets/ in the watched folder triggers an immediate BrowserSync event and injects changes on initial save.

Environment:

  • OS and Version: MacOS 10.15.2
  • Eleventy Version: 0.10.0
@chasemccoy
Copy link

chasemccoy commented Jun 30, 2020

Yep, I'm seeing this too on 0.11.0

@chasemccoy
Copy link

@zachleat This is quite an old issue... would it be helpful to refile this? It seems this could definitely be triaged as a bug.

@mmatuzovic
Copy link

If I remember correctly, I was able to fix this by removing ./src/assets/css/* from my .gitignore file.

#483

@ryanscherler
Copy link
Author

ryanscherler commented Jun 30, 2020

If I remember correctly, I was able to fix this by removing ./src/assets/css/* from my .gitignore file.

#483

I have since moved to a different method of compiling my CSS and no longer need this, but I also do recall solving this with making sure the the .gitignore didn't have the CSS reference. I'm thinking we can close this issue out and potentially reference this issue in a follow up regarding general watch target issues?

@chasemccoy
Copy link

chasemccoy commented Jun 30, 2020

In this case, I specifically wanted my CSS files to be ignored by git. I was able to solve this by turning off Eleventy's gitignore detection and then adding node_modules to my .eleventyignore file. Still, it would be nice if added watch targets bypassed the gitignore by default!

Thanks for the help!

@zachleat
Copy link
Member

I think this is a duplicate of #893 (which has a bit more info and discussion there)

Please follow along over there!

@zachleat zachleat added bug feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc labels Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug duplicate feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc
Projects
None yet
Development

No branches or pull requests

4 participants