Skip to content

Instantly share code, notes, and snippets.

View florianboudot's full-sized avatar

Florian Boudot florianboudot

View GitHub Profile
@etienne-dldc
etienne-dldc / extract-next-routes.ts
Created May 5, 2021 12:22
Extract routes in NextJS project to a TS file
import * as glob from "glob";
import * as path from "path";
import * as fse from "fs-extra";
import * as prettier from "prettier";
const PARAM_REG = /^\[(.+)\]$/;
type PageObj = { [key: string]: PageObj };
type PathItem = { type: "param" | "static"; name: string };
@romuleald
romuleald / getTpl.js
Last active May 3, 2016 09:54
get a template from a <script type="text/template"> and replace {{foo}} with {foo: 'bar'} → bar
var getTpl = (function () {
"use strict";
let cache = {};
var getCache = function (templateId) {
return cache[templateId];
};
var setCache = function (templateId, html) {
cache[templateId] = html;
};