It's a simple Jekyll plugin for building production-ready assets. It does not support asset bundling as in HTTP/2 world it's considered a bad practice.
Copy assets.rb into your _plugins folder. Then make sure uglifyjs
and cleancss
binaries are
in $PATH, or customize assets.rb to use JS and CSS optimization tools of your choice.
Note: if you end up customizing assets.rb it's a good practice to fork this repository and put your edited assets.rb there so you can track changes.
<link rel="stylesheet" href="{% asset_url /path/to/my.css %}">
<script src="{% asset_url /path/to/my.js %}"></script>
There is no need to change anything as all url()
declarations will be rewritten automatically.
Well, server push is still not widely supported (as of June 2016), so here's how:
{% asset_inline /path/to/my.css %}
Use --verbose
flag which changes Jekyll log level to debug
. In debug mode all optimizations are displayed in a build log.
Because I'm lazy and it would make customizations harder.
You can always download the current version with curl:
curl https://raw.githubusercontent.com/jakubpawlowicz/jekyll-simple-assets/v2.0.1/assets.rb -o _plugins/assets.rb && (echo "d0ac7abcdfcc5321a57d36f4c30353efd83330e5 _plugins/assets.rb" | shasum -c -)
Pull requests are welcome!
jekyll-simple-assets is released under the MIT License.