Skip to content

Instantly share code, notes, and snippets.

View rob-barber's full-sized avatar

Rob Barber rob-barber

View GitHub Profile
@rob-barber
rob-barber / index.html
Created November 11, 2020 21:00
Django/Webpack Multi-Page Web App Part-2 Updated index.html
{# templates/polls/index.html #}
{% load static %}
{% include '_auto_generated/development/js_bundle.html' %}
<link rel="stylesheet" type="text/css" href="{% static 'styles/index.css' %}">
<style>
body {
background: white url({% static 'images/background.gif' %}) no-repeat;
@rob-barber
rob-barber / IndexCoordinator.entry.js
Created November 11, 2020 20:56
Django/Webpack Multi-Page Web App Part-2 Sample JS Entry
'use strict'
// web_assets/js/IndexCoordinator.entry.js
class IndexClass {
initialize() {
console.log('Test');
window.alert('Build Successful!!');
}
}
@rob-barber
rob-barber / development-gitignore
Created November 11, 2020 20:24
Django/Webpack Multi-Page Web App Part-2 Git Ignore
# templates/_auto_generated/development/.gitignore
# Ignore all files within this directory except the gitignore
*
!.gitignore
@rob-barber
rob-barber / webpack_utils.js
Created November 11, 2020 20:04
Django/Webpack Multi-Page Web App Part-2 Webpack Utils
'use strict';
// _webpack_files/supporting/webpack_utils.js
const crypto = require('crypto');
const glob = require('glob');
// The directory name where the web assets that need to be compiled live
let assetsDirname = 'web_assets';
@rob-barber
rob-barber / webpack.config.js
Created November 11, 2020 20:01
Django/Webpack Multi-Page Web App Part-2 Webpack Configurations
'use strict';
// _webpack_files/webpack.config.js
/*
* This is the base config file that contains shared configurations for both production and development
* */
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
@rob-barber
rob-barber / gist:038014c6fe247c9b4bcb7631103d9de5
Created November 11, 2020 19:30
Django/Webpack Multi-Page Web App Part-2 babel.config.json
// babel.config.js
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
@rob-barber
rob-barber / package.json
Last active November 11, 2020 19:36
Django/Webpack Multi-Page Web App Part-2 package.json
{
"name": "webpack_multipage",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config ./_webpack_files/webpack.config.js",
"build-watch": "webpack --config ./_webpack_files/webpack.watch.config.js"
},
"author": "",
@rob-barber
rob-barber / index.html
Created November 11, 2020 16:52
Django/Webpack Multi-Page Web App Part-2 Styles
{# templates/polls/index.html #}
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'styles/style.css' %}">
<style>
body {
background: white url({% static 'images/background.gif' %}) no-repeat;
}
@rob-barber
rob-barber / settings.py
Created November 11, 2020 16:35
Django/Webpack Multi-Page Web App Part-2 Settings
# webpack_multipage/settings.py
######
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'), # Add this line
],
@rob-barber
rob-barber / admin.py
Created November 10, 2020 16:53
Django/Webpack Multi-Page Web App Part-1
# polls/admin.py
from django.contrib import admin
from .models import Question, Choice
class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3