Catalog npm
Back to packageRELEASE DETAILS

0.1.1

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-cZxs+d7N4C1PeFLO1bmmMr2VTIUEYo8pxBdiGhUxOXv2fEH8z7a4FEsuakxjX3ONfzNEh9juHSrB+HyXUCkIQw==",
  "shasum": "39506e28a7cf646701b3940ff15186aa9d4e6921",
  "tarball": "https://registry.npmjs.org/11ty-fast-dev/-/11ty-fast-dev-0.1.1.tgz",
  "fileCount": 7,
  "unpackedSize": 22125,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0v/4CRA9TVsSAnZWagAA2BgP+wRCsZNP2TdnEBDCX/W9\nXXPWYO5bP8iSU8wSxTdgZI0d95z6i9Ssx2JkA7i2qevE3Rk5i+RC/wi85p74\nPXmXNVhcgkjrYGxAXpMtPcYBeWoLFaonRmant9O3e6NaFWxvWv9nlOeK/mAr\n3TmYEMCwwHAL28NIYx59gbUOLexCzJu2+2khaAZVnYcNpzcHdNOJdYcQ9TDp\n9yPt630G8iv2tJyvCCN8gWWn3+cNpGPpJ37RSPO85D7HAIgClBkpS54S0Kdd\nrrF+9DFsRx2P/FSWdUX8m5eprKFBCaeOnaUPPTGi+VJJuCaTrJoNDwEswKOK\nYeYoT6mBVxR8Ip8/GLuApsv4Uf/GiD1LlmoakV6a7VNA0vBtXdu1rx4yJ4cz\nR2kehteljaojA1vUqJNzYuigl5s5YQboPmRKwtnQdwWpFaIZQZlG/D0rFCfy\nM/pbPK/ncEUral4KVghEdxtUNLJJGL8CEPkLoRbRZqo9dj2fakeX20oukfgg\nL2kXPLExoQNUVnrdZ+19r+mig4QuuuQQEY7h07arVoWWUcpTU4lr/2tbXToZ\nRBRC5fu/M573ONnR7rE74oWRUcS3NQeWc2D/AX0M2kIEMCiqEXF4/2Awkxzx\nOvmzVGb3fS3vt+prIORBsSaV3QRIcwI0ynO8cA1N3MIeNRgKpIc+xY3QE3/r\ntGDQ\r\n=bgg1\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIBHTsuHGU63bptzWon6lWF0ObHxy9wTkO0sq8WALvaEvAiEAok90n6A7ZzEIHvQ5BsLecGdSgLJcgWpLwBJP5B1AsLE="
    }
  ]
}

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:8b5ccae1a1930d2d2ddff879ea735f5ac0368add9ab091abb9556d25ff64cae8

Other collected versions

0.1.011 DecView all collected versions →