Last active
August 29, 2015 14:04
-
-
Save scottelundgren/a794411559f334383a4a to your computer and use it in GitHub Desktop.
auto_javascript_include_tag fails when directory_indexes is active
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
middleman init example.com | |
cd source | |
cp index.html.erb example.html.erb | |
edit example.html.erb to | |
--- | |
title: Example Page | |
--- | |
<h1>Example Page</h1> | |
<p>Hello, world!</p> | |
echo 'alert("Here is an alert.");' > /javascripts/example.js | |
edit javascripts/all.js | |
delete the line "//= require_tree .” | |
This keeps middleman from walking the /javascripts directory and compiling our test into one all.js file | |
edit layouts/layout.erb | |
add <%= auto_javascript_include_tag %>, before </head>, about line 14 | |
edit ../config.rb | |
remove the comment on line 40, enabling " activate :livereload” | |
middleman server | |
visit http://localhost:4567/ | |
The default page only should display. No javascript should display. | |
visit http://localhost:4567/example.html | |
An alert should display with the example page | |
edit ../config.rb | |
add activate :directory_indexes | |
visit http://localhost:4567/example/ | |
The alert will not display. Check the page source, example.js is not included. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment