question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Data option to process a template file but not write it to the output directory

See original GitHub issue

Something like write: false

This would be similar to the _underscoreprefix.html in jekyll.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
zachleatcommented, Sep 28, 2018

Hm? If you wanted to do this for an individual file you could use a template specific JS data file or probably even in front matter if you use the JS front matter type: https://www.11ty.io/docs/data-frontmatter/#javascript-front-matter

However, I’d rather move bikeshed discussions for a higher level drafts feature to https://github.com/11ty/eleventy/issues/188 if we could!

1reaction
zachleatcommented, Sep 28, 2018

@edwardhorsford yes, for data properties you can set them in data files (JS or JSON) or in front matter. This data cascade is documented here: https://www.11ty.io/docs/data/

With this feature, @adamsilver should be able to implement this himself by creating a directory-specific JS data file that looks for a --drafts command line flag. https://www.11ty.io/docs/data-js/ It could be conditional based on development or production environment variables too, sure.

E.g. a drafts.11tydata.js file in a drafts/ folder, continuing from this example: https://www.11ty.io/docs/data-js/#example%3A-exposing-environment-variables

module.exports = {
  permalink: process.env.ELEVENTY_ENV === "production" ? false : "/{{ fileSlug }}/"
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Save a workbook as a template
Click File > Options. Click Save, and then under Save workbooks, enter the path to the personal templates location in the Default personal...
Read more >
Using Templates
When we pass the template directory option to our toolset, we must pass the generator's root directory and not the library-only directory.
Read more >
Permalinks — Eleventy
To remap your template's output to a directory independent of the output directory ( --output ), use permalinkBypassOutputDir: true in your front matter....
Read more >
Reference for template.json · dotnet/templating Wiki
Instead of updating your source files to be tokenized you define replacements, and other processing, mostly in an external file, the template.
Read more >
Template a file out to a target host
ansible.builtin.template module – Template a file out to a target host · ansible-core and included in all Ansible installations. In most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found