Skip to content

Instantly share code, notes, and snippets.

View Danetag's full-sized avatar
🕺
Entertaining

Arnaud Tanielian Danetag

🕺
Entertaining
View GitHub Profile
...
render() {
const { openedMenu, onOpenMenu, state } = this.props;
return <button
id="menu-hamburger"
aria-controls="menu-mobile"
aria-expanded={openedMenu}
aria-haspopup={true}
...
render() {
const { items, openedMenu, onClose } = this.props;
return (
<Transition in={openedMenu} timeout={openedMenu ? 0 : 300}>
{(status) => (
<nav
id="menu-mobile"
const devServer = {};
const webpack = require("webpack");
const ENV = process.env.NODE_ENV === "production" ? "production" : "development";
const outputPath =
ENV === "production"
? path.resolve(__dirname + "../../static/")
: path.resolve(__dirname + "/dist/");
<?
function register_scripts() {
// include the base style in the header.
$base_js = WP_DEBUG ? 'http://localhost:8080/bundle.js' : get_stylesheet_directory_uri() . ( '/static/app.js' );
wp_register_script(
'base-script', // handle name.
$base_js,
null, // an array of dependent styles.
let currentView = null;
const pageLoaded = () => {
// "Routing"
const currentPage = document.querySelector("#content").firstElementChild;
switch (currentPage.id) {
case "home-page":
import(/* webpackChunkName: "homepage" */ "pages/homepage/homepage")
.then(currentViewImported)
import "scss/partials/pages/_homepage.scss";
export default class Homepage {
...
}
module.exports = {
...
output: {
...
chunkFilename: "[name]-[chunkhash].js",
}
}
{
"homepage.css": "1-c554ec31e68977100d81.css",
"homepage.js": "homepage-c554ec31e68977100d81.js",
"main.css": "main.7f74f1d39af13e4eef77.css",
"main.js": "main.7f74f1d39af13e4eef77.js"
}
<?
// // Load Manifest Asset
$manifest = WP_DEBUG ? array('main.css' => '', 'main.js' => '') : json_decode(file_get_contents(dirname(__FILE__)."/static/manifest.json"), true);
/**
* Register Scripts().
*/
function register_scripts($manifest) {