开发者

Can Jekyll act over css or js files?

开发者 https://www.devze.com 2023-01-28 12:56 出处:网络
I\'m using Jekyll for one of my projec开发者_开发百科ts and it really seems a very good alternative for developing simple websites but maintaining some processes automated.

I'm using Jekyll for one of my projec开发者_开发百科ts and it really seems a very good alternative for developing simple websites but maintaining some processes automated.

It's nice how the Liquid Extensions work, so I was wondering if it's possible to make Jekyll act over js and css files too.

So I could have my main.css like:

@import url("/stylesheets/reset.css?{{site.time | date: '%Y%m%d%H%M%S'}}");
@import url("/stylesheets/config.css?{{site.time | date: '%Y%m%d%H%M%S'}}");

Using some of the helpers I have and also some variables I could create using YML front matter, don't know if it's possible through.

But since it only generated static files I don't see why I wouldn't be able to do so.

Thanks


Yep. You just have to add a YAML block to the file, and Jekyll will process it. The YAML block can be empty:

---
---
@import url("/stylesheets/reset.css?{{site.time | date: '%Y%m%d%H%M%S'}}");
@import url("/stylesheets/config.css?{{site.time | date: '%Y%m%d%H%M%S'}}");


You should try the Jekyll Assets plugin, it really helps dealing with CSS and JS assets.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号