Skip to content

Instantly share code, notes, and snippets.

@rattlion
Created August 28, 2014 17:55
Show Gist options
  • Save rattlion/b23b0514ebada82547e3 to your computer and use it in GitHub Desktop.
Save rattlion/b23b0514ebada82547e3 to your computer and use it in GitHub Desktop.

Local modal dev setup

<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName modal.dev
  ServerAlias www.modal.dev
  DocumentRoot /Users/mryan/Code/modal
  ErrorLog /private/var/log/apache2/modal.error_log
  CustomLog /private/var/log/apache2/modal.access_log common
</VirtualHost>

Directory listing

.
├── README.md
├── index.php
└── sanky-modal
    ├── config.rb
    ├── css
    │   ├── bootstrap.css
    │   ├── modal.css
    │   └── modal.scss
    ├── humans.txt
    ├── img
    │   ├── bg.jpg
    │   └── x.png
    ├── js
    │   ├── bootstrap.js
    │   └── main.js
    └── markup
        └── ccfa.html

5 directories, 12 files

index.php

<!DOCTYPE html>
<html class="no-js">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Modal Dev</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <style type="text/css" media="screen">
      html {
        background-color: #DDEAF8;
      }
    </style>
  </head>
  <body>
      <script src="sanky-modal/js/main.js?<?= time() ?>"></script>
      <script type="text/javascript" charset="utf-8">
        SankyModal.setCookie('sanky_modal', 'sanky_modal', 0);
        SankyModal.init();
      </script>
  </body>
</html>

The additional script tag is particularly helpful to void cookie expiration.

Sometimes I update modals directly in the parent repo, but sometimes we don't control the website. This setup is particularly helpful for testing such modals.

IMPORTANT: whenever packaging a modal for someone else to deploy. Copy the folder to your desktop or some clean location. Remove the hidden .git folder. Then zip it up. We don't want to inadvertently offer up our entire history with all branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment