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

New passthrough copy during serve / symlinks #2485

Closed
TigersWay opened this issue Jul 2, 2022 · 3 comments
Closed

New passthrough copy during serve / symlinks #2485

TigersWay opened this issue Jul 2, 2022 · 3 comments

Comments

@TigersWay
Copy link
Contributor

TigersWay commented Jul 2, 2022

Describe the bug
While the use of the recursive-copy package allow to use symlinks, it seems it does not not work in dev mode (--serve)

eleventyConfig.addPassthroughCopy("img", {
    expand: true, // expand symbolic links
  });

To Reproduce
Steps to reproduce the behavior:

...
 eleventyConfig.addPassthroughCopy({'node_modules/@fontsource/allura/files': 'css/files'}, {expand: true});
...

Will not work under pnpm & dev mode
But I can easily guess i could find other "use case"

Expected behavior
Same behavior for build mode or dev mode

Environment:
Only important element, I use pnpm not npm

Following: #2456

@pdehaan
Copy link
Contributor

pdehaan commented Jul 2, 2022

I've never used pnpm, but here's what I'm seeing (macOS 12.4, Node 16.15.x ft. npm 8.11.0 and pnpm 7.5.0):

npm version
{
  '11ty-2485': '1.0.0',
  npm: '8.11.0',
  node: '16.15.1',
  ...
}

npm install -g pnpm
pnpm --version # 7.5.0

# install dependencies
pnpm install

pnpm serve

> 11ty-2485@1.0.0 serve /private/tmp/11ty-2485
> eleventy --serve

[11ty] Writing www/index.html from ./src/index.njk
[11ty] Copied 8 files / Wrote 1 file in 0.10 seconds (v1.0.1)
[11ty] Watching…
[Browsersync] Access URLs:
 -----------------------------------
    Local: http://localhost:8082
 External: http://192.168.7.121:8082
 -----------------------------------
[Browsersync] Serving files from: www

So it seems to be copying 8 files (macOS 12.4).

Here's my .eleventy.js file:

// .eleventy.js
module.exports = function (eleventyConfig) {
  eleventyConfig.addPassthroughCopy({'node_modules/@fontsource/allura/files': 'css/files'}, {expand: true});
  
  return {
    dir: {
      input: "src",
      output: "www",
    }
  };
};

… and my package.json:

{
  "name": "11ty-2485",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "vercheck": "npm version",
    "build": "eleventy",
    "serve": "eleventy --serve",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Peter deHaan <peter@deseloper.com>",
  "license": "MPL-2.0",
  "devDependencies": {
    "@11ty/eleventy": "^1.0.1",
    "@fontsource/allura": "^4.5.9"
  },
  "description": ""
}

And the contents of my output folder:

tree www

www/
├── css/
│   └── files/
│       ├── allura-all-400-normal.woff
│       ├── allura-latin-400-normal.woff
│       ├── allura-latin-400-normal.woff2
│       ├── allura-latin-ext-400-normal.woff
│       ├── allura-latin-ext-400-normal.woff2
│       ├── allura-vietnamese-400-normal.woff
│       ├── allura-vietnamese-400-normal.woff2
│       └── file-list.json
└── index.html

2 directories, 9 files

@pdehaan
Copy link
Contributor

pdehaan commented Jul 2, 2022

Ah, although, i think the behavior might be subtlety different in v2.0.0-canary.12:

pnpm build

> 11ty-2485@1.0.0 build /private/tmp/11ty-2485
> eleventy

[11ty] Writing www/index.html from ./src/index.njk
[11ty] Copied 8 files / Wrote 1 file in 0.04 seconds (v2.0.0-canary.12)

versus:

 pnpm serve

> 11ty-2485@1.0.0 serve /private/tmp/11ty-2485
> eleventy --serve

[11ty] Writing www/index.html from ./src/index.njk
[11ty] Wrote 1 file in 0.17 seconds (v2.0.0-canary.12)
[11ty] Watching…
[11ty] Server at http://localhost:8082/

@TigersWay
Copy link
Contributor Author

Sorry for your time @pdehaan ! I have no idea how I manage it yesterday despite all the tests and tries I did, but it's working great today 😊
pnpm is still great!
eleventy 2.0 is the best!

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

No branches or pull requests

2 participants