mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 06:05:31 +03:00
Remove obsolete files.
This commit is contained in:
parent
0374cfd68c
commit
46bf960bae
@ -1,69 +1 @@
|
|||||||
# elm-pages
|
# elm-pages
|
||||||
|
|
||||||
Static site generator for elm-markup.
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Install Dependencies
|
|
||||||
|
|
||||||
`npm install`
|
|
||||||
|
|
||||||
### Running Locally
|
|
||||||
|
|
||||||
`npm start`
|
|
||||||
|
|
||||||
Will compile your app and serve it from http://localhost:1234/
|
|
||||||
Changes to your source code will trigger a hot-reload in the browser, which
|
|
||||||
will also show compiler errors on build failures.
|
|
||||||
|
|
||||||
### Running Tests
|
|
||||||
|
|
||||||
`npm test`
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
`npm run autotest`
|
|
||||||
|
|
||||||
To re-run tests when files change.
|
|
||||||
|
|
||||||
### Production build
|
|
||||||
|
|
||||||
`npm run build`
|
|
||||||
|
|
||||||
Will generate a production-ready build of your app in the `dist` folder.
|
|
||||||
|
|
||||||
### Elm Commands
|
|
||||||
|
|
||||||
Elm binaries can be found in `node_modules/.bin`. They can be run from within
|
|
||||||
your project via `npx`
|
|
||||||
|
|
||||||
|
|
||||||
To install new Elm packages, run:
|
|
||||||
|
|
||||||
`npx elm install <packageName>`
|
|
||||||
|
|
||||||
## Libraries & Tools
|
|
||||||
|
|
||||||
These are the main libraries and tools used to build elm-pages. If you're not
|
|
||||||
sure how something works, getting more familiar with these might help.
|
|
||||||
|
|
||||||
### [Elm](https://elm-lang.org)
|
|
||||||
|
|
||||||
Elm is a delightful language for creating reliable webapps. It guarantees no
|
|
||||||
runtime exceptions, and provides excellent performance. If you're not familiar
|
|
||||||
with it, [the official guide](https://guide.elm-lang.org) is a great place to get
|
|
||||||
started, and the folks on [Slack](https://elmlang.herokuapp.com) and
|
|
||||||
[Discourse](https://discourse.elm-lang.org) are friendly and helpful if you get
|
|
||||||
stuck.
|
|
||||||
|
|
||||||
### [Elm Test](https://package.elm-lang.org/packages/elm-exploration/test/latest)
|
|
||||||
|
|
||||||
This is the standard testing library for Elm. In addition to being useful for
|
|
||||||
traditional fixed-input unit tests, it also supports property-based testing
|
|
||||||
where random data is used to validate behavior over a large input space. It's
|
|
||||||
really useful!
|
|
||||||
|
|
||||||
### [Parcel](https://parceljs.org)
|
|
||||||
|
|
||||||
Parcel build and bundles the application's assets into individual HTML, CSS, and
|
|
||||||
JavaScript files. It also runs the live-server used during development.
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
@ -1,8 +1,6 @@
|
|||||||
// import { Elm } from "../Main.elm";
|
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
const { Elm } = require("./src/Main.elm");
|
const { Elm } = require("./src/Main.elm");
|
||||||
const pagesInit = require("elm-pages");
|
const pagesInit = require("elm-pages");
|
||||||
// import { imageAssets } from "./image-assets";
|
|
||||||
|
|
||||||
const imageAssets = {};
|
const imageAssets = {};
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
module.exports = {
|
|
||||||
routes: [
|
|
||||||
"/about", "/docs/file-structure", "/docs", "/"
|
|
||||||
],
|
|
||||||
rendererConfig: { renderAfterDocumentEvent: "prerender-trigger" }
|
|
||||||
};
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
const { Elm } = require("./cli.js");
|
|
||||||
|
|
||||||
const app = Elm.Main.init();
|
|
||||||
|
|
||||||
app.ports.toJsPort.subscribe(payload => {
|
|
||||||
console.log("payload", payload);
|
|
||||||
});
|
|
@ -1,10 +0,0 @@
|
|||||||
// @ts-ignore
|
|
||||||
import { Elm } from "../Main.elm";
|
|
||||||
// @ts-ignore
|
|
||||||
import { imageAssets } from "./image-assets";
|
|
||||||
import { pagesInit } from "./helper";
|
|
||||||
|
|
||||||
pagesInit({
|
|
||||||
mainElmModule: Elm.Main,
|
|
||||||
imageAssets
|
|
||||||
});
|
|
@ -1,9 +0,0 @@
|
|||||||
// @ts-ignore
|
|
||||||
import { Elm } from "../ManifestMain.elm";
|
|
||||||
// @ts-ignore
|
|
||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
const app = Elm.ManifestMain.init({ flags: null });
|
|
||||||
app.ports.generateManifest.subscribe((manifestJson: Object) => {
|
|
||||||
fs.writeFileSync("./dist/manifest.webmanifest", JSON.stringify(manifestJson));
|
|
||||||
});
|
|
@ -1,27 +0,0 @@
|
|||||||
export function pagesInit({ mainElmModule, imageAssets }: any) {
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
let app = mainElmModule.init({
|
|
||||||
flags: { imageAssets }
|
|
||||||
});
|
|
||||||
|
|
||||||
app.ports.toJsPort.subscribe((headTags: [Head]) => {
|
|
||||||
if (navigator.userAgent.indexOf("Headless") >= 0) {
|
|
||||||
headTags.forEach(headTag => {
|
|
||||||
appendTag(headTag);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
document.dispatchEvent(new Event("prerender-trigger"));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
type Head = { name: string; attributes: [string, string][] };
|
|
||||||
|
|
||||||
function appendTag(tagDetails: Head) {
|
|
||||||
const meta = document.createElement(tagDetails.name);
|
|
||||||
tagDetails.attributes.forEach(([name, value]) => {
|
|
||||||
meta.setAttribute(name, value);
|
|
||||||
});
|
|
||||||
document.getElementsByTagName("head")[0].appendChild(meta);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
globDirectory: "dist/",
|
|
||||||
globPatterns: ["**/*.{html,js}"],
|
|
||||||
swDest: "dist/service-worker.js",
|
|
||||||
runtimeCaching: [
|
|
||||||
{
|
|
||||||
// Match any request that ends with .png, .jpg, .jpeg or .svg.
|
|
||||||
// urlPattern: /^https:\/\/fonts\.googleapis\.com/,
|
|
||||||
urlPattern: /^https:\/\/fonts\.gstatic\.com/,
|
|
||||||
|
|
||||||
// Apply a cache-first strategy.
|
|
||||||
handler: "CacheFirst",
|
|
||||||
|
|
||||||
options: {
|
|
||||||
// Use a custom cache name.
|
|
||||||
cacheName: "fonts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user