hexojs / hexo-renderer-less

Less renderer for Hexo.
https://hexo.io/
MIT License
15 stars 10 forks source link

how to use , have any demo #46

Open fish-uncle opened 4 years ago

fish-uncle commented 4 years ago
// _config.yml
less:
  paths: ['layout/source/less']
  compress: true

How to reference on the page?

curbengh commented 4 years ago

Similar to hexo-renderer-stylus which renders hexo-theme-landscape.

'layout/source/less' should have one main 'style.less' which may reference to other Less files ('_variables.less, notice the underscore). 'style.less' will be rendered tohttp://yoursite.com/less/style.cssand embeds it in your theme using<%- css('/less/style.css') %>`, assuming you're using EJS for your theme.


btw, the compress option has been deprecated. suggest to use hexo-clean-css to minify css.

rpav commented 4 years ago

Apparently this is actually in <theme>/source/less/*.less (vs incorrectly: <theme>/layout/source/less/*.less).

This should probably be documented up front and center in the README as it's a slightly critical detail that should not take an hour to hunt down or depend on internal knowledge of how some other thing does things.