The place to start your next frontend application in 2019
This is a Hello World application, using Babel 7, Prettier, Tailwind, Mithril JSX (optional), PurgeCSS, Laravel Mix, Chai and Mocha.
In the project's folder:
yarn # install dependencies
yarn prod # build for production
yarn server # serve the prodution build
Open a browser at the given Local URL.
Always use prettier before commiting your code.
It is recommanded to install an extension that formats on save, like VSCode's Prettier - Code formatter.
If you do install it, add the following line in your workspace settings:
{
"editor.formatOnSave": true
}
As for Prettier, it is recommended that you use an extension that respects the .editorconfig file.
In VSCode, you can install EditorConfig for VS Code.
Builds in development mode (no optimizations).
Builds in development mode and automatically reloads when files have been altered.
Builds in production mode.
Starts a simple webserver in the public directory, serving a single file (usefull for SPA).
Runs Prettier on all files inside the source directory.
Runs Mocha, the test framework, on all files in the test folder
Install the Babel plugin.
yarn add -D @babel/plugin-transform-react-jsx
Add the following in .babelrc:
{
...
"plugins": [
...
[
"@babel/plugin-transform-react-jsx",
{
"pragma": "m",
"pragmaFrag": "m.fragment"
}
]
]
}
If you enable JSX, you still need to import Mithril in all files that use JSX.
import m from 'mithril'