All Projects â†’ developit â†’ Preact Boilerplate

developit / Preact Boilerplate

🎸 Ready-to-rock Preact starter project, powered by Webpack.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Preact Boilerplate

Preact Starter
Webpack3 boilerplate for building SPA / PWA / offline front-end apps with Preact
Stars: ✭ 384 (-59.96%)
Mutual labels:  webpack, boilerplate, pwa, preact
Redux React Starter
DEPRECATED use the new https://github.com/didierfranc/react-webpack-4
Stars: ✭ 137 (-85.71%)
Mutual labels:  webpack, boilerplate, preact
Preact Minimal
🚀 Minimal preact structure
Stars: ✭ 136 (-85.82%)
Mutual labels:  webpack, pwa, preact
Typescript Webpack React Redux Boilerplate
React and Redux with TypeScript
Stars: ✭ 182 (-81.02%)
Mutual labels:  webpack, boilerplate, css-modules
Suicrux
🚀 Ultimate universal starter with lazy-loading, SSR and i18n. [not maintained]
Stars: ✭ 958 (-0.1%)
Mutual labels:  webpack, boilerplate, pwa
Universal Native Boilerplate
Build apps for every native platform with React and React Native
Stars: ✭ 131 (-86.34%)
Mutual labels:  webpack, boilerplate, pwa
Jekyll Webpack Boilerplate
⚡ī¸ A boilerplate with Jekyll and Webpack to make the most performant static websites
Stars: ✭ 182 (-81.02%)
Mutual labels:  webpack, boilerplate, pwa
Webxr Webpack Boilerplate
Starter Kit for building rich, immersive WebXR projects (featuring A-Frame) PWA with Webpack and SASS
Stars: ✭ 48 (-94.99%)
Mutual labels:  webpack, boilerplate, pwa
React Redux Boilerplate
Awesome React Redux Workflow Boilerplate with Webpack 4
Stars: ✭ 307 (-67.99%)
Mutual labels:  webpack, boilerplate, css-modules
Kratos Boilerplate
đŸ”Ĩ A simple boilerplate for creating statics PWA using Webpack, Pug, PostCSS and CSS Modules
Stars: ✭ 308 (-67.88%)
Mutual labels:  webpack, boilerplate, css-modules
Pwa
An opinionated progressive web app boilerplate
Stars: ✭ 353 (-63.19%)
Mutual labels:  webpack, boilerplate, pwa
React Boilerplate
React Boilerplate
Stars: ✭ 128 (-86.65%)
Mutual labels:  webpack, boilerplate, css-modules
React Cool Starter
😎 đŸŖ A starter boilerplate for a universal web app with the best development experience and a focus on performance and best practices.
Stars: ✭ 1,083 (+12.93%)
Mutual labels:  webpack, boilerplate, css-modules
React Pages Boilerplate
Deliver react + react-router application to gh-pages
Stars: ✭ 134 (-86.03%)
Mutual labels:  webpack, boilerplate, css-modules
React Boilerplate
Production-ready boilerplate for building universal web apps with React and Redux
Stars: ✭ 53 (-94.47%)
Mutual labels:  webpack, boilerplate, css-modules
React Redux Universal Boilerplate
An Universal ReactJS/Redux Boilerplate
Stars: ✭ 165 (-82.79%)
Mutual labels:  webpack, boilerplate, css-modules
Preact Redux Isomorphic
preact-redux-isomorphic PWA SPA SSR best practices and libraries in under 80kB page size (for live demo click the link below)
Stars: ✭ 85 (-91.14%)
Mutual labels:  boilerplate, pwa, preact
Tris Webpack Boilerplate
A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
Stars: ✭ 1,016 (+5.94%)
Mutual labels:  webpack, boilerplate, pwa
React
Extremely simple boilerplate, easiest you can find, for React application including all the necessary tools: Flow | React 16 | redux | babel 6 | webpack 3 | css-modules | jest | enzyme | express + optional: sass/scss
Stars: ✭ 244 (-74.56%)
Mutual labels:  webpack, boilerplate, css-modules
Nyancss
🌈 Write plain CSS while reaping benefits of CSS-in-JS
Stars: ✭ 544 (-43.27%)
Mutual labels:  webpack, preact, css-modules

Preact Boilerplate / Starter Kit Build Status Preact Slack Community

🎸 Ready-to-rock Preact starter project, powered by webpack. (View Demo)

🚀 Note: We now recommend Preact CLI for new projects.

Preact CLI is a natural evolution of this boilerplate, and improves on it in every way. In a single dependency, you get a friendly command line project creation and build tool with development & production modes. Preact CLI requires no configuration at all, and even does automatic code-splitting without you lifting a finger! It also produces bundles roughly half the size of preact-boilerplate.


Quick-Start Guide

Installation

1. Clone this repo:

git clone --depth 1 https://github.com/developit/preact-boilerplate.git my-app
cd my-app

2. Make it your own:

rm -rf .git && git init && npm init

ℹī¸ This re-initializes the repo and sets up your NPM project.

3. Install the dependencies:

npm install

You're done installing! Now let's get started developing.

Development Workflow

4. Start a live-reload development server:

npm run dev

This is a full web server nicely suited to your project. Any time you make changes within the src directory, it will rebuild and even refresh your browser.

5. Testing with mocha, karma, chai, sinon via phantomjs:

npm test

🌟 This also instruments the code in src/ using isparta, giving you pretty code coverage statistics at the end of your tests! If you want to see detailed coverage information, a full HTML report is placed into coverage/.

6. Generate a production build in ./build:

npm run build

You can now deploy the contents of the build directory to production!

Surge.sh Example: surge ./build -d my-app.surge.sh

Netlify Example: netlify deploy

Deploy to Netlify

5. Start local production server with serve:

npm start

This is to simulate a production (CDN) server with gzip. It just serves up the contents of ./build.


Structure

Apps are built up from simple units of functionality called Components. A Component is responsible for rendering a small part of an application, given some input data called props, generally passed in as attributes in JSX. A component can be as simple as:

class Link extends Component {
  render({ to, children }) {
    return <a href={ to }>{ children }</a>;
  }
}
// usage:
<Link to="/">Home</Link>

CSS Modules

This project is set up to support CSS Modules. By default, styles in src/style are global (not using CSS Modules) to make global declarations, imports and helpers easy to declare. Styles in src/components are loaded as CSS Modules via Webpack's css-loader. Modular CSS namespaces class names, and when imported into JavaScript returns a mapping of canonical (unmodified) CSS classes to their local (namespaced/suffixed) counterparts.

When imported, this LESS/CSS:

.redText { color:red; }
.blueText { color:blue; }

... returns the following map:

import styles from './style.css';
console.log(styles);
// {
//   redText: 'redText_local_9gt72',
//   blueText: 'blueText_local_9gt72'
// }

Note that the suffix for local classNames is generated based on an md5 hash of the file. Changing the file changes the hash.


Handling URLS

💁 This project contains a basic two-page app with URL routing.

Pages are just regular components that get mounted when you navigate to a certain URL. Any URL parameters get passed to the component as props.

Defining what component(s) to load for a given URL is easy and declarative. You can even mix-and-match URL parameters and normal props.

<Router>
  <A path="/" />
  <B path="/b" id="42" />
  <C path="/c/:id" />
</Router>

React Compatibility

This project includes preact-compat alias in as react and react-dom right out-of-the-box. This means you can install and use third-party React components, and they will use Preact automatically! It also means that if you don't install third-party React components, preact-compat doesn't get included in your JavaScript bundle - it's free if you don't use it 👍


License

MIT

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].