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

Proposal: simplify elder.config.js #27

Closed
jbmoelker opened this issue Sep 3, 2020 · 2 comments · Fixed by #35
Closed

Proposal: simplify elder.config.js #27

jbmoelker opened this issue Sep 3, 2020 · 2 comments · Fixed by #35

Comments

@jbmoelker
Copy link

jbmoelker commented Sep 3, 2020

The current elder.config.js exposes a lot of internals, like locations.svelte.ssrComponents and locations.intersectionObserverPoly. Would it be an idea to reduce the surface that's exposed, simplify the API and make it more common to other frameworks like Next.js and NuxtJS?

current elder.config.js:

module.exports = {
  server: {
    prefix: '',
  },
  build: {},
  locations: {
    assets: './public/dist/static/',
    public: './public/',
    svelte: {
      ssrComponents: './___ELDER___/compiled/',
      clientComponents: './public/dist/svelte/',
    },
    systemJs: '/dist/static/s.min.js',
    intersectionObserverPoly: '/dist/static/intersection-observer.js',
  },
  debug: {},
  hooks: {},
  plugins: {},
};

proposal elder.config.js:

module.exports = {
  target: 'static',                   // default, other values could be 'server' and later maybe 'serverless'
  rootDir: process.cwd(),    // default
  srcDir:  'src/',                     // default, relative to rootDir
  distDir: 'dist/',                    // default, relative to rootDir, was 'public/'
  server: {
    prefix: '',
  },
  build: {},
  debug: {},
  hooks: {},
  plugins: {},
};
@nickreese
Copy link
Contributor

@jbmoelker I like the idea of simplifying the config. I was never a fan of locations, reworking config was on my notepad to tackle.

Thoughts:

  • target: Should this be in the config? I ask because passing it into the new Elder initialization gives us flexibility without having to muck with config files. We can have a server for previewing, build process, and even a serverless process all just by changing the input into new Elder.
  • I've recently added siteUrl (added in v0.1.0 yesterday) To be able to build fully qualified URLs.

I'm happy to review a PR on this (and #28) if you guys are hacking on it.

@jbmoelker jbmoelker changed the title Suggestion: simplify elder.config.js Proposal: simplify elder.config.js Sep 10, 2020
@nickreese
Copy link
Contributor

@jbmoelker All of this is configured aside from the target as it doesn't really work with how Elder.js is currently being used.

#35

Going to be migrating several plugins and our sites to this version of Elder.js then will likely release v1.

@nickreese nickreese linked a pull request Sep 16, 2020 that will close this issue
34 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants