Skip to content

Instantly share code, notes, and snippets.

@anmsh
Created October 26, 2021 07:54
Show Gist options
  • Save anmsh/69f5ca4f317b80d02c54061ccf5c9ec1 to your computer and use it in GitHub Desktop.
Save anmsh/69f5ca4f317b80d02c54061ccf5c9ec1 to your computer and use it in GitHub Desktop.
Preact-01
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
</head>
<!--
Dumber Gist uses dumber bundler, the default bundle file
is /dist/entry-bundle.js.
The starting module is pointed to "index" (data-main attribute on script)
which is your src/index.js.
-->
<body>
<div id="root"></div>
<script src="/dist/entry-bundle.js" data-main="index"></script>
</body>
</html>
{
"dependencies": {
"preact": "latest"
}
}
import { h, Component } from 'preact';
// Try to create a css/scss/sass/less file then import it here.
//
// Note to preact-cli users: preact-cli turns on css-mdules by default. But for simplicity, dumber-gist did not turn on css-modules.
// https://github.com/css-modules/css-modules
//
// However, dumber bundler supports css-modules through gulp.
// https://github.com/dumberjs/gulp-dumber-css-module
export default class App extends Component {
render() {
return (
<div>
<h1>Hello Preacts!</h1>
</div>
);
}
}
import { h, render } from 'preact';
import App from './app';
render(<App />, document.getElementById('root'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment