View counter.js
// A simple counter example | |
// The setup will be more complicated in modern apps built using React | |
const incrementNode = document.getElementById('increment'); | |
const decrementNode = document.getElementById('decrement'); | |
const inputNode = document.getElementById('counter'); | |
const counter = { | |
initialize() { | |
incrementNode.addEventListener('click', (event) => { |
View window-auth-popup.es6.js
/* global window */ | |
const popup = (url) => { | |
const windowArea = { | |
width: Math.floor(window.outerWidth * 0.8), | |
height: Math.floor(window.outerHeight * 0.5), | |
}; | |
if (windowArea.width < 1000) { windowArea.width = 1000; } | |
if (windowArea.height < 630) { windowArea.height = 630; } |
View Gemfile
source 'https://rubygems.org' | |
ruby '2.2.6' | |
gem 'rails', '~> 5.1.x' | |
gem 'sprockets', '~> 4.x' |
View create_heroku_ruby_with_node.sh
heroku create | |
heroku addons:create heroku-postgresql:hobby-dev | |
git push heroku master |
View index.js
// Initialize the counter code when DOM is ready | |
import './style.sass'; | |
import counter from './counter'; | |
document.addEventListener('DOMContentLoaded', () => { | |
counter.initialize(); | |
}); |
View style.sass
$grey: #f2f2f2 | |
.counter-wrapper | |
max-width: 500px | |
margin: 100px auto | |
padding: 10px | |
border: 1px solid $grey | |
form |
View counter.js
// Require or import the counter module | |
import '../counter'; |
View index.js
// Initialize the counter code when DOM is ready | |
import counter from './counter'; | |
document.addEventListener('DOMContentLoaded', () => { | |
counter.initialize(); | |
}); |
View production.js
// Note: You must restart bin/webpack-watcher for changes to take effect | |
var webpack = require('webpack') | |
var merge = require('webpack-merge') | |
var sharedConfig = require('./shared.js') | |
module.exports = merge(sharedConfig.config, { | |
output: { filename: '[name]-[hash].js' }, |
NewerOlder