Skip to content

Instantly share code, notes, and snippets.

View pmallol's full-sized avatar

Paula Mallol pmallol

View GitHub Profile
@pmallol
pmallol / keybase.md
Created February 7, 2019 18:26
keybase.md

Keybase proof

I hereby claim:

  • I am pmallol on github.
  • I am pmallol (https://keybase.io/pmallol) on keybase.
  • I have a public key whose fingerprint is 16B3 2515 409C F3B1 9C10 6B84 25FE F17E FBDA 14FB

To claim this, I am signing this object:

@pmallol
pmallol / middleman-webpack-demo: package.json
Last active July 3, 2020 22:05
Add Webpack scripts to package.json
...
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack --watch --color -d",
"build": "webpack --bail -p"
},
@pmallol
pmallol / middleman-webpack-demo: webpack.config.js
Last active July 3, 2020 22:06
Add Webpack configuration file
// Add this to a webpack.config.js file
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
entry: {
site: ['./source/javascripts/site.js'],
style: ['./source/stylesheets/site.css.scss'],
},
@pmallol
pmallol / middleman-webpack-demo: config.rb
Created July 3, 2020 22:09
Add Webpack as external pipeline to Middleman
# Webpack
activate :external_pipeline,
name: :webpack,
command: build? ?
"./node_modules/webpack/bin/webpack.js --bail -p" :
"./node_modules/webpack/bin/webpack.js --watch -d --progress --color",
source: ".tmp/dist",
latency: 1
# Dev environment
@pmallol
pmallol / middleman-webpack-demo: layout.erb
Created July 3, 2020 22:12
Modify assets name files when adding Webpack to Middleman
<!doctype html>
<html>
<head>
...
<%= stylesheet_link_tag "style" %>
<%= javascript_include_tag "site.min" %>
</head>
...
@pmallol
pmallol / middleman-webpack-demo Dockerfile
Last active July 6, 2020 19:14
Dockerfile to build a docker image with Ruby 2.6 and Node.js
# Dockerfile
FROM ruby:2.6.3
WORKDIR /app
RUN curl -sL https://deb.nodesource.com/setup_13.x -o nodesource_setup.sh && \
bash nodesource_setup.sh && \
apt install nodejs
@pmallol
pmallol / middleman-webpack-demo docker-compose.yml
Created July 6, 2020 19:17
Add docker-compose.yml to configure docker containers necessary to have a dockerized Middleman app
# docker-compose.yml
version: '3.7'
services:
web:
build: .
command: bundle exec middleman server
volumes:
- '.:/app'
@pmallol
pmallol / middleman-webpack-demo config.rb
Last active July 6, 2020 19:27
Add LiveReload to a Middleman app running inside Docker
# Activate and configure extensions
# ...
# Livereload
activate :livereload, host: '0.0.0.0', port: '1234'
@pmallol
pmallol / middleman-webpack-demo config.rb
Created July 6, 2020 20:46
Configure build in Middleman, add a :http_prefix to generate relative links in GitHub Pages
# config.rb
#...
# Build-specific configuration
# https://middlemanapp.com/advanced/configuration/#environment-specific-settings
configure :build do
# Generate relative paths to the repo when deploying to GitHub Pages
config[:http_prefix] = '/middleman-webpack-demo'
@pmallol
pmallol / middleman-webpack-demo index.html.erb
Last active July 6, 2020 20:54
Create an About page in Middleman app hosted in GitHub Pages
<!-- ../souce/about/index.html.erb -->
---
title: About
---
<h1>
Hi there!
</h1>