Coder Social home page Coder Social logo

Comments (2)

ABuffSeagull avatar ABuffSeagull commented on July 4, 2024 1

Oh, since this uses cosmiconfig, you should be able to just make a prerender.config.js like this:

const articles = require("./articles");

module.exports = {
  routes: articles
    .filter(article => article.attributes.url.slice(0, 4) !== 'http')
    .map(article => article.attributes.url)
}

(I don't believe it supports ES Modules yet)

from parcel-plugin-prerender.

konsumer avatar konsumer commented on July 4, 2024

Here is an example I am using currently, if anyone is curious:

src/prerender.js:

import { writeFileSync } from 'fs'
import articles from './articles'

const routes = articles
  .filter(article => article.attributes.url.slice(0, 4) !== 'http')
  .map(article => article.attributes.url)

writeFileSync(`${__dirname}/../.prerenderrc`, JSON.stringify(routes))

articles.js exports an array of front-matter-parsed articles & menu-items with defaults in attributes.url.

my package.json has this:

{
  "scripts": {
    "build": "rimraf dist && parcel build src/index.html",
    "prebuild": "rimraf .prerenderrc && parcel build --target=node --no-source-maps src/prerender.js && node dist/prerender.js",
  }
}

This works fine, but it'd be neat if it was integrated so I didn't need the prebuild

from parcel-plugin-prerender.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.