All Projects → cedricss → Elm Batteries

cedricss / Elm Batteries

Licence: mit
Learn how Elm, Parcel, Cypress and Netlify work together. Get started with Elm navigation, routes, remote data and decoder.

Programming Languages

elm
856 projects

Projects that are alternatives of or similar to Elm Batteries

Fast
Develop, build, deploy, redeploy, and teardown frontend projects fast.
Stars: ✭ 126 (+16.67%)
Mutual labels:  parcel, postcss
Static Site Boilerplate
A better workflow for building modern static websites.
Stars: ✭ 1,633 (+1412.04%)
Mutual labels:  netlify, postcss
Weather Preactpi
A tiny UI for daily weather forcasts ⛈
Stars: ✭ 13 (-87.96%)
Mutual labels:  parcel, netlify
Jamstack Web Starter
Static website workflow utilising Eleventy, Tailwind CSS, Webpack and PostCSS.
Stars: ✭ 198 (+83.33%)
Mutual labels:  netlify, postcss
video-to-markdown
How to embed a video in markdown? Here the answer. Add videos to your markdown files easier.
Stars: ✭ 159 (+47.22%)
Mutual labels:  parcel, netlify
parcel-static-template
Start a simple static site with components and hot reloading.
Stars: ✭ 20 (-81.48%)
Mutual labels:  parcel, netlify
Purescript React Realworld
A real-world application demonstrating PureScript and React
Stars: ✭ 81 (-25%)
Mutual labels:  parcel, netlify
Gatsby Shopify Theme
🛒 Simple theme to build a blazing simple and fast store with Gatsby and Shopify.
Stars: ✭ 95 (-12.04%)
Mutual labels:  netlify
Gatsby Starter Saas Marketing
☁️ A simple one page marketing site starter for SaaS companies and indie hackers
Stars: ✭ 103 (-4.63%)
Mutual labels:  netlify
Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (-13.89%)
Mutual labels:  postcss
Uncss
Remove unused styles from CSS
Stars: ✭ 9,170 (+8390.74%)
Mutual labels:  postcss
Nuxt Netlify
Dynamically generate `_headers` and `_redirects` files for Netlify in your Nuxt.js projects
Stars: ✭ 97 (-10.19%)
Mutual labels:  netlify
Webpack4.x
webpack4.x详细配置步骤
Stars: ✭ 103 (-4.63%)
Mutual labels:  postcss
Shortstack
🥞 minimal Rollup + PostCSS modern syntax starter template
Stars: ✭ 94 (-12.96%)
Mutual labels:  postcss
Postcss Uncss
Use uncss as a postcss plugin
Stars: ✭ 105 (-2.78%)
Mutual labels:  postcss
Postcss Font Family System Ui
PostCSS plugin to transform W3C CSS font-family: system-ui to a practical font-family list
Stars: ✭ 91 (-15.74%)
Mutual labels:  postcss
Postcss Plugins
The "officially unofficial" consolidated list of PostCSS plugins in a ready-to-use package
Stars: ✭ 107 (-0.93%)
Mutual labels:  postcss
Neat Starter
Starter Template for Netlify CMS, Eleventy, Alphine JS & Tailwind CSS
Stars: ✭ 104 (-3.7%)
Mutual labels:  netlify
Wordpressify
🎈 A build system designed to automate your WordPress development workflow.
Stars: ✭ 1,374 (+1172.22%)
Mutual labels:  postcss
Rtlcss
Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
Stars: ✭ 1,363 (+1162.04%)
Mutual labels:  postcss

MIT license Netlify Status

Elm Batteries Included

A project template and a generator to:

  • Learn how Elm, Parcel, Cypress and Netlify work together 😋
  • Get started with Elm css, navigation, routes, remote data and JSON decoder

Features

  • Local web server and optional serverless functions
  • Hot code and style reloading, keeping app state
  • CSS transformations with postcss (autoprefixer, purgecss...)
  • Front-end testing
  • Optimized and minified production build
  • Preview and production deployments

Table of contents ›

Quick Start

  • npm init elm-batteries ./my-elm-app
  • or yarn create elm-batteries ./my-elm-app
  • or generate from Github

Learn more ›

The generated Elm app. Started with Parcel
behind Netlify Dev and tested with Cypress:

elm-batteries template demo

Test file source: demo.spec.js

Links

Overview

Usage with npm or yarn

Website documentation (sneak peek)

Table of contents

Setup

From the CLI

The CLI lets you pick the batteries to include in your app:

create-elm-batteries cli generator

npm

npm init elm-batteries ./my-elm-app
cd my-elm-app && npm run dev

or yarn

yarn create elm-batteries ./my-elm-app
cd my-elm-app && yarn dev

From the repository template

Use this Github Template

Click Use this template to generate a new public or private project from elm-batteries.

Install the dependencies with npm install or yarn install and run npm run dev or yarn dev.


💡 In the following documentation, if you use yarn, run yarn <command-name> (instead of npm run <command-name>). Alternatively, you can define short aliases in your terminal to run these commands.

Local development

Develop

To run serverless functions along your Elm app, run

npm run dev

or

yarn dev

Then open localhost:8888

Netlify Dev on top of Parcel and serverless functions

✓ development build with Parcel
✓ web server with Parcel behind Netlify Dev
✓ serverless functions on your local machine
✓ hot code swapping with elm-hot

⚠️ Netlify Dev connects to the 1234 default Parcel port. Make sure this port isn't used by another application.

Develop without Netlify Dev

Read Elm + Parcel to use this project template without Netlify Dev and serverless functions.

Run a live session

To share your development session with a coworker, run:

npm run dev:live

✓ development build with Parcel
✓ live sharing with Netlify Dev

Testing

Run Cypress

These tests are in cypress/integration/*. Start your Elm app then launch the Cypress runner app:

npm run cypress:open

If you open one test from the list of spec files (for example demo.spec.js) then you should see your application loaded:

Cypress runner app

Alternatively, to run Cypress tests from the CLI without the GUI:

npm run cypress

The Elm app uses data-* attributes to provide context to the selectors and insulate them from CSS or JS changes. Learn more ›

To learn more about Cypress and play with it, install and start it in a fresh new project folder: it will initialize a cypress folder with several examples.

Run unit and fuzz tests

Install elm-test.

These tests are in tests/*. To start the runner in watch mode:

npm run test:watch

Alternatively, run it just once:

npm run test

Production build and deployment

Build for production and deploy a preview

npm run deploy

or

yarn deploy

✓ production build with Parcel
✓ compilation with the Elm optimize flag
✓ minification with terser
✓ deployment to a Netlify Live Draft URL

💡 If you are using Netlify for the first time, run netlify login to authenticate (learn more about Netlify CLI).

💡 The JS code from Elm is minified with special flags that work for Elm apps because they have no side-effects (otherwise it would be unreliable to use such flags).

If this preview looks good, deploy to production.

Deploy to production

npm run deploy:prod

✓ deployment to production with Netlify

Going further

deploy commands are great when rapidly iterating. Consider also setting up continuous deployment with Netlify ».

Designing

Tailwind CSS, an utility-first CSS framework, is included along with:

purgecss and cssnano are used on production mode to minify the css. They are ignored on development mode.

See also

Meta tags

index.html has meta tags included, like Twitter Card tags and Open Graph tags. Make sure to update their values and the content preview image (img/content_preview.jpg).

Elm

Navigation

  • All links in an application create a UrlRequest (read Browser.application).
  • A navigation Key is needed to create navigation commands that change the URL: it is stored in the Model.
  • Nav.pushUrl changes the address bar without starting a page load.

Links and sources

License

Authored by Cédric Soulas, released under the MIT License. Read LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].