Skip to content

Instantly share code, notes, and snippets.

View ssougnez's full-sized avatar

Sébastien Sougnez ssougnez

View GitHub Profile
"scripts": {
"dev": "webpack-dev-server --mode=development --open",
"build": "webpack --mode=development",
"release": "webpack"
}
...
module.exports = {
...
module: {
rules: [
...
{
test: /\.(png|jpg|gif)$/,
use: {
...
module.exports = {
output: {
...
publicPath: "/"
},
...
};
function log(message) {
console.log(message);
}
export function add(x, y) {
log(`Adding ${x} to ${y}`);
return x + y;
}
import "./assets/css/global.css";
import * as math from "./math";
let addition = math.add(5, 6);
let subtraction = math.subtract(10, 20);
console.log(addition);
console.log(subtraction);
console.log(math.pi);
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
module: {
...
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
})
Last known cursor location was: <span id="span-location"></span>
observable.subscribe({
next: callback,
error: callback,
complete: callback
});
observable.subscribe(next, error, complete);
import { fromEvent } from "rxjs";
let span = document.querySelector("#span-location");
fromEvent(document, "mousemove")
.subscribe((e) => {
span.innerHTML = `X: ${e.clientX} - Y: ${e.clientY}`;
});