Skip to content

data from the command-lineΒ #674

@ahl

Description

@ahl

Is your feature request related to a problem? Please describe.
I am running eleventy in development and from netlify. I'd like the ability to inject some data from the environment into my templates.

Describe the solution you'd like
A command line option to the eleventy command to either specify a file with data (json/js/etc) or specify k/v pairs on the command line.

e.g. eleventy --data baseUrl=$DEPLOY_PRIMEURL

Describe alternatives you've considered
Here's how I worked around it with javascript data in a file I called _data/site.json:

module.exports = function() {
  return new Promise((resolve, reject) => {
    var url = process.env.CONTEXT == 'production' ?
      process.env.URL :
      process.env.DEPLOY_PRIME_URL;
    resolve({
      "baseUrl": url || "http://localhost:8080"
    });
  });
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions