Created
October 26, 2021 07:54
-
-
Save anmsh/69f5ca4f317b80d02c54061ccf5c9ec1 to your computer and use it in GitHub Desktop.
Preact-01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"preact": "latest" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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