Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Placing assets in subdirectories breaks LiveReload #56

Closed
dcalhoun opened this Issue · 2 comments

2 participants

David Calhoun Rob Wierzbowski
David Calhoun

TL;DR

Jekyll's exclude option in _config.yml doesn't appear to accept subdirectories.

Details

The default configuration for the JavaScript directory is js. If during the configuration you choose to place it in a subdirectory, say assets/js, it breaks the LiveReload of the JavaScript.

From my testing, it seems that Jekyll's _config.yml exclude option does not accept paths to subdirectories. You may only pass file or folder names. Jekyll is ignoring requests to exclude assets/js and the JavaScript (and any other asset in a subdirectory) is copied to the .jekyll directory. The server looks in the .jekyll directory for assets prior to looking in app.

This isn't an issue when using CoffeeScript compilation as the CoffeeScript files are compiled into .tmp. The server looks in .tmp before looking into .jekyll or app, so it ignores the fact that the JavaScript files are in .jekyll. Note: I haven't tested it, but I'm would imagine this would happen with CSS v Sass as well.

Possible Solutions

  1. Ask the user if they would like to place all the assets in a subdirectory. If they provide a directory to place all the assets, then add that directory to the exclude array rather than each asset directory.
  2. Copy the JavaScript from app to .tmp on save, as the server would look there first.
  3. Not allow subdirectories for assets. :frowning:

Thoughts?

Rob Wierzbowski

Great report. Can you:

  • Post your _config.yml (or the relevant parts of it)?
  • Check the Jekyll issue tracker and see if this is a known bug (hopefully with some known workarounds we can add to the generator)?
David Calhoun

It looks like this is just the way Jekyll's _config.yml exclude option works currently. You can successfully exclude assets/js by listing js in the exclude array. The only downside is that this will globally exclude any directory named "js". Hopefully that won't be an issue for generator-jekyllrb users.

I'll put together a PR with a fix.

David Calhoun dcalhoun referenced this issue from a commit in dcalhoun/generator-jekyllrb
David Calhoun Fix LiveReload for asset subdirectories. Fixes #56. 3da361a
David Calhoun dcalhoun referenced this issue from a commit in dcalhoun/generator-jekyllrb
David Calhoun Merge remote-tracking branch 'upstream/master'
* upstream/master:
  Bump version to 1.1.0
  Add README note on nested directories
  Refine exclude dir generation
  Fix LiveReload for asset subdirectories. Fixes #56.
  Add private: true to the default package.json
  Clean up bundle install logic, add a warning message if it fails at end of install
  Move coffeelint reference in readme
  Revert bundler sequence to repair creation of default Jekyll site.
  Move coffeelint task with like tasks
  Add lint task for coffee files.
9fede29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.