Skip to content

Instantly share code, notes, and snippets.

View awestbro's full-sized avatar

Aaron Westbrook awestbro

View GitHub Profile
@awestbro
awestbro / index.html
Created April 19, 2020 14:54
Highlighting margin, border, and padding with Javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Highlighting elements example</title>
</head>
<body>
defmodule Myproject.LayoutView do
use Myproject.Web, :view
defp render_flash(type, message) do
~E"""
<div class="alert alert-<%= type %>" role="alert">
<%= message %>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
def view do
quote do
use Phoenix.View, root: "web/templates"
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, get_flash: 1, view_module: 1]
<body>
<nav class="navbar navbar-toggleable-sm navbar-inverse bg-primary mb-3">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<%= link "Myproject", to: page_path(@conn, :index), class: "navbar-brand" %>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li><a href="/" class="nav-link">Button</a></li>
const CopyWebpackPlugin = require("copy-webpack-plugin");
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: ['bootstrap-loader', './web/static/js/app.js'],
output: {
path: "./priv/static/dist",
filename: "app.js"
},
module.exports = {
plugins: [
require('postcss-flexbugs-fixes'),
require('autoprefixer')({
browsers: [
// Stolen from: https://github.com/twbs/bootstrap/blob/v4-dev/grunt/postcss.js
// Official browser support policy:
// https://v4-alpha.getbootstrap.com/getting-started/browsers-devices/#supported-browsers
//
'Chrome >= 35', // Exact version number here is kinda arbitrary
logLevel: debug
bootstrapVersion: 4
extractStyles: true
useFlexbox: true
styleLoaders:
- style-loader
- css-loader?-autoprefixer
- resolve-url-loader?sourceMap
- postcss-loader?sourceMap
- sass-loader?sourceMap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Hello Myproject!</title>
config :myproject, Myproject.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [node: ["node_modules/webpack/bin/webpack.js", "--watch-stdin", "--progress", "--color",
cd: Path.expand("../", __DIR__)]]
{
"repository": {},
"license": "MIT",
"scripts": {
"deploy": "webpack -p",
"watch": "webpack --watch-stdin --progress --color"
},
"dependencies": {
"phoenix": "file:deps/phoenix",
"phoenix_html": "file:deps/phoenix_html"