Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

11ty-fast-dev

11ty-fast-dev

Published11 Dec 2020
Direct dependencies1
Transitive dependenciesNot calculated

README

Current package documentation

This makes 11ty more efficient when used behind a dev server, making it only compiles your pages when you actually want to see them.

This relies on you running your own dev server. (This could be built into eleventy --serve, I don't know.)

⚠️ This is a crazy idea and perhaps not intended for production use just yet. You're welcome!

Usage

Your .eleventy.js should be updated like this:

TODO(samthor): This should be flagged or only run in --watch mode.

const eleventyFastDev = require('11ty-fast-dev/patch');

module.exports = eleventyConfig => {
  // We can't set up 11ty-fast-dev here, but instead need to do it later in
  // 11ty's lifecycle. Its calculation of collections is a great place, as this
  // is before any files are written.
  // TODO(samthor): We only want to do this when flagged or in watch mode and
  // so on.
  const config = eleventyFastDev.buildConfig(eleventyConfig);
  eleventyConfig.addCollection('_11ty-fast-dev', config);

  // ... the rest of your config
};

Add this handler to your web server (this uses Express):

const {buildEleventyFastDevHandler} = require('11ty-fast-dev/handler');

const staticPaths = ['dist'];  // 11ty writes here by default
const eleventyFastDevHandler = buildEleventyFastDevHandler(staticPaths);

// Insert this _before_ your static handlers, so old dist files don't "win".
app.use(eleventyFastDevHandler);

Profit!

Implementation

The eleventy side does two things:

  • monkeypatches TemplateWriter._writeTemplate so that instead of writing a template, we store this ability into a closure
  • opens a web server on "localhost:9999", and when the right page is requested, renders the file

On the server side, it's a pretty basic handler which then goes out and asks "localhost:9999" for the right page.

Downsides

This will, as stated, only execute your templates and run transforms when you request a file. If you have side effects in these places, then this won't work for you. (This is generally considered a bad idea anyway).

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
node-fetch
Environment
{
  "local_name": "node-fetch",
  "alias": false,
  "peer_metadata": null
}
^2.6.1runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-zoHAT7tTWmh/qJxh7bWWhplQFWVbqCFrrldFLcUiCssAYaJmO9cFWLpxe1jy36DYOvXS51pshsFohqAerQTE9g==",
  "shasum": "ae8a3f58a3abadf57655e43ae3a5bbd816151ff4",
  "tarball": "https://registry.npmjs.org/11ty-fast-dev/-/11ty-fast-dev-0.1.0.tgz",
  "fileCount": 7,
  "unpackedSize": 22128,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0v+bCRA9TVsSAnZWagAAb6cP/iruwXZsIy8EQpMxR2Ne\nkM9iNvymKHHMKkEbFx6OMDnBCWrBGenWGcGGHOyxDOpYm+86UcEe1ixXmolD\nQMTm3btU9jvN6LbqSxzI7UPTm28gi+SnqaLjjqN2DUJsvF/RcH1+8VsaYxxP\nxBMTKfld4gWR/MQ1qkgssTauE4qbXPPaKPHcq8qiLS4K2vS4ElgAFyzepCKQ\nVo9ZOIY+6J87zsBRThyR3BzCnpdopXpIMmYm6S+DrA7fQAoVQf8MewllA8XD\n8gMgzB1xZ34bEYaLv+z1fVw+SgQba/lpMOasgs+Q+FST1d2EcGVxyjOC5zQd\nxUn6UVGfTgwxy8Qovt/2eh0R2jWnMN5RQcRlAdq1c/PK/JGLyYJH3goKtwAi\nIBtcd2+lUul/fAJN4Q6byJ2YnwhbBAEdrZgGD28wCKfg87sNCL9Cg9yQH4nF\n0YJLLrMnnySdy2s4vUK/qeR2FPg8kIlLUJPtocp2Aia1tikyXMJs5LbY+uW0\nc8jNdcALe31D3seDOGjCrE3hrgSmncyk+tMNjxyZoJ7r+w3lFqE6bJyfcI90\n87kmj9JNZkney7mXvNVzLVKerWHltEfou+Vr8a1XF8QolqmM4fu9YtkmYtL3\nFusyGGQ9qflTF9illwO2lY5Y/l05d1vbVaO1ZpxLeNhr1CYFTDpoCaF9g/iJ\nrOJ6\r\n=Z+I5\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIQDOyZlRgaTcfppMkjqd783CK1Hp/9yzthF75S/Sew7QGQIgZ5gyeyHJ3A2EXg8aycgIbrPCxhJAkG/iuYbZNqHCEvs="
    }
  ]
}

Repository

PENDING
samthor/11ty-fast-dev

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:05 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:9a2b6fd8acb7a71111ea7d2e590b377b7c8002fa835919ef9ce1685bf079e7fb

Other collected versions

0.1.111 DecView all collected versions →