surjithctly / neat-starter

Starter Template for Netlify CMS, Eleventy, Alpine JS & Tailwind CSS
https://neat-starter.netlify.app/
MIT License
333 stars 105 forks source link

call browsersync explictly for simpler watching #10

Closed homosaur closed 3 years ago

homosaur commented 3 years ago

I have never been able to get passthrough and watch working correctly on Mac, so I moved to call BrowserSync explicitly rather than through Eleventy and simply build the PostCSS file as normal instead of using a tmp directory. This should provide more flexibility later rather than changing the 11ty config everytime you have a new static asset generated.

surjithctly commented 3 years ago

Hello @homosaur

Thanks for the PR. looks good to me. Two questions

  1. Each time I refresh, there is a browsersync black box appearing in the top right (Browsersync: Connected). can we remove that? it bit irritating.
  2. So, does browsersync will copy everything from the /static folder now? We still have a line eleventyConfig.addPassthroughCopy("./src/static/img");
homosaur commented 3 years ago

@surjithctly

  1. Yes, the --no-notify flag will remove this. Additionally there is a --no-open flag that will block automatically opening a browser window when Browsersync runs, although personally I'm always doing this anyway, so it saves a click. Specifically, here are the default 11ty options that it uses when running Browsersync. It would be easy to emulate exactly this setup from the CLI tool if desired.
  2. Browsersync will only handle the serving and hot reloading of assets that change in the served directory. I'd recommend you still move the static files by using 11ty's passthrough copy.
surjithctly commented 3 years ago

Thank you