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

addWatchTarget ignored when used in a custom config file #1448

Closed
gael-ian opened this issue Oct 14, 2020 · 6 comments
Closed

addWatchTarget ignored when used in a custom config file #1448

gael-ian opened this issue Oct 14, 2020 · 6 comments
Labels

Comments

@gael-ian
Copy link

Hi,

When used in a custom config file, addWatchTarget is ignored.

To Reproduce

Steps to reproduce the behavior:

  1. Clone this repository and install dependencies.
    It's nothing more than Eleventy's Getting started with 2 config files: .eleventy.js and config/eleventy.js. Both contain a call to addWatchTarget.
  2. Run DEBUG=Eleventy npx @11ty/eleventy --serve.
  3. addWatchTarget works:
    Eleventy Watching for changes to: [ './assets/**', './**/*.liquid', […], './**/*.11tydata.js' ] +5ms
    
  4. Rename the default .eleventy.js: mv .eleventy.js ._eleventy.js
  5. Run DEBUG=Eleventy npx @11ty/eleventy --config=config/eleventy.js --serve
  6. addWatchTarget is broken:
    Eleventy Watching for changes to: [ './**/*.liquid', […], './**/*.11tydata.js' ] +5ms
    

Expected behavior

addWatchTarget should work when called from a custom config file.

As a bonus, should .eleventy.js even be loaded when Eleventy is called with a custom config file ?

@binyamin
Copy link
Member

Confirmed. addWatchTarget() does not work with any custom config file.
@gael-ian Thanks for the detailed bug report.

@daflh
Copy link

daflh commented Dec 31, 2020

Has this been fixed?

@TigersWay
Copy link
Contributor

Still not fixed and pretty annoying! Any trouble with #1568 from @dafiulh ?

greatislander added a commit to greatislander/wecount.inclusivedesign.ca that referenced this issue Apr 6, 2021
cindyli pushed a commit to inclusive-design/wecount.inclusivedesign.ca that referenced this issue Apr 6, 2021
* feat: improve sass compilation process

* fix: use default config file name until 11ty/eleventy#1448 is fixed
@davidbwaters
Copy link

davidbwaters commented May 22, 2021

OMG, thanks for this. Needs fix or note.

@einomi
Copy link

einomi commented Sep 30, 2021

Any updates on this? Looks like this PR adds a fix for this issue?

@zachleat
Copy link
Member

As a bonus, should .eleventy.js even be loaded when Eleventy is called with a custom config file ?

Confirmed this as already fixed (tested in 2.x and 1.x)

As for the PR #1568 I was able to confirm that this issue is no longer relevant on 1.x:

DEBUG=Eleventy* npx @11ty/eleventy --watch --config=eleventy.config.js
[11ty] Wrote 0 files in 0.08 seconds (v1.0.1)
Eleventy Watching for changes to: [ './assets/**',          './**/*.liquid', './**/*.ejs',           './**/*.md', './**/*.hbs',           './**/*.mustache', './**/*.haml',          './**/*.pug', './**/*.njk',           './**/*.html', './**/*.11ty.js',       './**/*.11ty.cjs', './_includes/**',       './_data/**', './eleventy.config.js', './**/*.json', './**/*.11tydata.cjs',  './**/*.11tydata.js' ] +5ms
// eleventy.config.js
module.exports = function(eleventyConfig) {
  eleventyConfig.addWatchTarget("assets/**");
};

Thanks everyone! (please speak up if I’m wrong!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants