Add the ability to precompile assets to the source directory. #66

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

dnl commented Dec 14, 2013

This enables using safe mode and the default jekyll setup on github pages,
as long jekyll build is run once in unsafe mode after files in
the _assets directory are modified.

I'm doing this because jekyll-assets is the only plugin I'm using
and this gives me the flexibility to make changes to _posts using
the github interface or something.

@dnl dnl Add the ability to precompile assets to the source directory.
This enables using safe mode and the default jekyll on github pages,
as long it `jekyll build` is run once in unsafe mode after files in
the _assets directory are modified.

I'm doing this because `jekyll-assets` is the only plugin I'm using
and this gives me the flexibility to make changes to `_posts` using
the github interface or something.
415680d

Coverage Status

Coverage remained the same when pulling 415680d on dnl:master into 9ac861a on ixti:master.

dnl commented Dec 14, 2013

This change did require me to put this in my layout, as I wasn't sure how to tell jekyll-assets what files to write without using the liquid tags, and it doesn't allow me to use the cache busting.

{% capture assets %}
    {{ 'application.css' | asset_path }}
    {{ 'libs/modernizr.js' | asset_path }}
    {{ 'libs/jquery.js' | asset_path }}
    {{ 'application.js' | asset_path }}
{% endcapture %}

I have a plan for restoring cache-busting though. Writing an _include containing just the stylesheet and javascript links when run in unsafe mode, that can be included even in safe mode.

Member
ixti commented Dec 25, 2013

I don't see any value in this workflow. You can't have any 3rd party plugins on github pages anyway, so you won't be able to have your asset_path helper or tag running on GH. That leads to the question how else you would refer to dynamically compiled assets? If using "well-known" path, then there's no need to use jekyll-assets at all IMHO, it's easier to use sprockets CLI instead, so you will have same structure (_assets) and a small rake task that will execute sprockets to prebuild assets. Actually you can even use JekyllAssets interface to get to force compile assets:

site     = Jekyll::Site.new Jekyll.configuration Hash.new
manifest = Sprockets::Manifest.new site.assets, "_site/assets/manifest.json"
manifest.compile "application.css", "application.js" # ...
@ixti ixti closed this May 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment